qol: simplify and Tuple.Create()

This commit is contained in:
Gary Sharp
2025-07-20 15:58:42 +10:00
parent 4c27b0ff3c
commit fd43d85778
17 changed files with 138 additions and 138 deletions
+3 -3
View File
@@ -75,14 +75,14 @@ namespace Disco.Services.Expressions
public Tuple<string, bool, object> Evaluate(object ExpressionContext, IDictionary Variables)
{
if (Count == 0)
return new Tuple<string, bool, object>(string.Empty, false, null);
return Tuple.Create(string.Empty, false, (object)null);
if (!IsDynamic)
{
if (Count != 1)
throw new InvalidOperationException("Non-dynamic expressions should only have one part");
if (this[0] is TextExpressionPart textPart)
return new Tuple<string, bool, object>(textPart.RawSource, false, null);
return Tuple.Create(textPart.RawSource, false, (object)null);
else
throw new InvalidOperationException("Non-dynamic expressions should have a single TextExpressionPart component");
}
@@ -115,7 +115,7 @@ namespace Disco.Services.Expressions
}
}
}
return new Tuple<string, bool, object>(resultValue.ToString(), resultError, resultObject);
return Tuple.Create(resultValue.ToString(), resultError, resultObject);
}
public static Expression TokenizeSingleDynamic(string Name, string ExpressionSource, int Ordinal)
{
@@ -208,7 +208,7 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
}
}
return new Tuple<int, int, double>(bestColumnCount, bestRowCount, bestItemRatio);
return Tuple.Create(bestColumnCount, bestRowCount, bestItemRatio);
}