30% OFF - 10th Anniversary discount on new purchases until December 15 with code: ZZZANNIVERSARY10
C# Eval Expression LINQ Dynamic - Reverse
LINQ Dynamic Reverse Examples
C# Dynamic LINQ Reverse examples using an Expression Evaluator.
Reverse
This C# example uses the LINQ Where method with a dynamic expression to find all elements of an array less than 5.
LINQ
private void uiReverse_Simple_1_LINQ_Click(object sender, EventArgs e) { string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; var reversedIDigits = digits.Where(d => d[1] == 'i').Reverse(); var sb = new StringBuilder(); sb.AppendLine("A backwards list of the digits with a second character of 'i':"); foreach (var d in reversedIDigits) { sb.AppendLine(d); } My.Result.Show(My.LinqResultType.Linq, uiResult, sb); }
LINQ Execute
private void uiReverse_Simple_1_LINQ_Execute_Click(object sender, EventArgs e) { string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; var reversedIDigits = digits.Where(d => d[1] == 'i').Execute<IEnumerable<string>>("Reverse()"); var sb = new StringBuilder(); sb.AppendLine("A backwards list of the digits with a second character of 'i':"); foreach (var d in reversedIDigits) { sb.AppendLine(d); } My.Result.Show(My.LinqResultType.LinqExecute, uiResult, sb); }
Result
A backwards list of the digits with a second character of 'i':
nine
eight
six
five