@@ -19,49 +19,49 @@ This C# example uses the LINQ All method with a dynamic expression to determine
1919### LINQ
2020{% highlight csharp %}
2121private void uiAll_Simple_LINQ_Click(object sender, EventArgs e)
22- {
23- int[ ] numbers = {1, 11, 3, 19, 41, 65, 19};
22+ {
23+ int[ ] numbers = {1, 11, 3, 19, 41, 65, 19};
2424
25- var onlyOdd = numbers.All(n => n % 2 == 1);
25+ var onlyOdd = numbers.All(n => n % 2 == 1);
2626
27- var sb = new StringBuilder();
27+ var sb = new StringBuilder();
2828
29- sb.AppendLine("The list contains only odd numbers: {0}", onlyOdd);
29+ sb.AppendLine("The list contains only odd numbers: {0}", onlyOdd);
3030
31- My.Result.Show(My.LinqResultType.Linq, uiResult, sb);
32- }
31+ My.Result.Show(My.LinqResultType.Linq, uiResult, sb);
32+ }
3333{% endhighlight %}
3434
3535### LINQ Dynamic
3636{% highlight csharp %}
3737private void uiAll_Simple_LINQ_Dynamic_Click(object sender, EventArgs e)
38- {
39- int[ ] numbers = {1, 11, 3, 19, 41, 65, 19};
38+ {
39+ int[ ] numbers = {1, 11, 3, 19, 41, 65, 19};
4040
41- var onlyOdd = numbers.All(n => "n % 2 == 1");
41+ var onlyOdd = numbers.All(n => "n % 2 == 1");
4242
43- var sb = new StringBuilder();
43+ var sb = new StringBuilder();
4444
45- sb.AppendLine("The list contains only odd numbers: {0}", onlyOdd);
45+ sb.AppendLine("The list contains only odd numbers: {0}", onlyOdd);
4646
47- My.Result.Show(My.LinqResultType.LinqDynamic, uiResult, sb);
48- }
47+ My.Result.Show(My.LinqResultType.LinqDynamic, uiResult, sb);
48+ }
4949{% endhighlight %}
5050
5151### LINQ Execute
5252{% highlight csharp %}
5353private void uiAll_Simple_LINQ_Execute_Click(object sender, EventArgs e)
54- {
55- int[ ] numbers = {1, 11, 3, 19, 41, 65, 19};
54+ {
55+ int[ ] numbers = {1, 11, 3, 19, 41, 65, 19};
5656
57- var onlyOdd = numbers.Execute<bool>("All(n => n % 2 == 1)");
57+ var onlyOdd = numbers.Execute<bool>("All(n => n % 2 == 1)");
5858
59- var sb = new StringBuilder();
59+ var sb = new StringBuilder();
6060
61- sb.AppendLine("The list contains only odd numbers: {0}", onlyOdd);
61+ sb.AppendLine("The list contains only odd numbers: {0}", onlyOdd);
6262
63- My.Result.Show(My.LinqResultType.LinqExecute, uiResult, sb);
64- }
63+ My.Result.Show(My.LinqResultType.LinqExecute, uiResult, sb);
64+ }
6565{% endhighlight %}
6666
6767### Result
@@ -78,55 +78,55 @@ This C# example uses the LINQ All method with a dynamic expression to return a g
7878### LINQ
7979{% highlight csharp %}
8080private void uiAll_Grouped_LINQ_Click(object sender, EventArgs e)
81- {
82- var products = My.GetProductList();
81+ {
82+ var products = My.GetProductList();
8383
84- var productGroups = products.GroupBy(p => p.Category)
85- .Where(g => g.All(p => p.UnitsInStock > 0))
86- .Select(g => new {Category = g.Key, Products = g});
84+ var productGroups = products.GroupBy(p => p.Category)
85+ .Where(g => g.All(p => p.UnitsInStock > 0))
86+ .Select(g => new {Category = g.Key, Products = g});
8787
88- var sb = new StringBuilder();
88+ var sb = new StringBuilder();
8989
90- My.ObjectDumper.Write(sb, productGroups, 1);
90+ My.ObjectDumper.Write(sb, productGroups, 1);
9191
92- My.Result.Show(My.LinqResultType.Linq, uiResult, sb);
93- }
92+ My.Result.Show(My.LinqResultType.Linq, uiResult, sb);
93+ }
9494{% endhighlight %}
9595
9696### LINQ Dynamic
9797{% highlight csharp %}
9898private void uiAll_Grouped_LINQ_Dynamic_Click(object sender, EventArgs e)
99- {
100- var products = My.GetProductList();
99+ {
100+ var products = My.GetProductList();
101101
102- var productGroups = products.GroupBy(p => p.Category)
103- .Where(g => g.All(p => "p.UnitsInStock > 0"))
104- .Select(g => new {Category = g.Key, Products = g});
102+ var productGroups = products.GroupBy(p => p.Category)
103+ .Where(g => g.All(p => "p.UnitsInStock > 0"))
104+ .Select(g => new {Category = g.Key, Products = g});
105105
106- var sb = new StringBuilder();
106+ var sb = new StringBuilder();
107107
108- My.ObjectDumper.Write(sb, productGroups, 1);
108+ My.ObjectDumper.Write(sb, productGroups, 1);
109109
110- My.Result.Show(My.LinqResultType.LinqDynamic, uiResult, sb);
111- }
110+ My.Result.Show(My.LinqResultType.LinqDynamic, uiResult, sb);
111+ }
112112{% endhighlight %}
113113
114114### LINQ Execute
115115{% highlight csharp %}
116116private void uiAll_Grouped_LINQ_Execute_Click(object sender, EventArgs e)
117- {
118- var products = My.GetProductList();
117+ {
118+ var products = My.GetProductList();
119119
120- var productGroups = products.GroupBy(p => p.Category)
121- .Where(g => g.Execute<bool>("All(p => p.UnitsInStock > 0)"))
122- .Select(g => new { Category = g.Key, Products = g });
120+ var productGroups = products.GroupBy(p => p.Category)
121+ .Where(g => g.Execute<bool>("All(p => p.UnitsInStock > 0)"))
122+ .Select(g => new { Category = g.Key, Products = g });
123123
124- var sb = new StringBuilder();
124+ var sb = new StringBuilder();
125125
126- My.ObjectDumper.Write(sb, productGroups, 1);
126+ My.ObjectDumper.Write(sb, productGroups, 1);
127127
128- My.Result.Show(My.LinqResultType.LinqExecute, uiResult, sb);
129- }
128+ My.Result.Show(My.LinqResultType.LinqExecute, uiResult, sb);
129+ }
130130{% endhighlight %}
131131
132132### Result
0 commit comments