Skip to content

Commit 2146886

Browse files
Merge pull request #12581 from dotnet/main
Merge main into live
2 parents 146aa0d + f926b6a commit 2146886

69 files changed

Lines changed: 228 additions & 176 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
5+
namespace SequenceExamples
6+
{
7+
class Program
8+
{
9+
// This part is just for testing the examples
10+
static void Main(string[] args)
11+
{
12+
MaxBy.MaxByKeySelectorExample();
13+
MaxBy.MaxByComparerExample();
14+
}
15+
16+
#region MaxBy
17+
static class MaxBy
18+
{
19+
public static void MaxByKeySelectorExample()
20+
{
21+
// <Snippet212>
22+
(string Name, decimal Salary, int Age)[] employees =
23+
{
24+
("Mahmoud", 1000m, 22),
25+
("John", 1200m, 28),
26+
("Sara", 2000m, 32),
27+
("Hadi", 1750m, 27),
28+
("Lana", 1500m, 24),
29+
("Luna", 1850m, 33)
30+
};
31+
32+
// Get the oldest employee in the company.
33+
var oldestEmployee = employees.MaxBy(employee => employee.Age);
34+
35+
Console.WriteLine($"Name: {oldestEmployee.Name}, Age: {oldestEmployee.Age}, Salary: ${oldestEmployee.Salary}");
36+
37+
/*
38+
This code produces the following output:
39+
40+
Name: Luna, Age: 33, Salary: $1850
41+
*/
42+
// </Snippet212>
43+
}
44+
45+
public static void MaxByComparerExample()
46+
{
47+
// <Snippet213>
48+
(string Name, int Quantity)[] inventory =
49+
{
50+
("apple", 10),
51+
("BANANA", 5),
52+
("Cherry", 20)
53+
};
54+
55+
// Find the product with the maximum name alphabetically, ignoring casing differences.
56+
// 'C' is correctly identified as greater than 'a' and 'B' when case is ignored.
57+
var maxIgnoreCase = inventory.MaxBy(item => item.Name, StringComparer.OrdinalIgnoreCase);
58+
Console.WriteLine($"Case-insensitive comparison: {maxIgnoreCase.Name}");
59+
60+
/*
61+
This code produces the following output:
62+
63+
Case-insensitive comparison: Cherry
64+
*/
65+
// </Snippet213>
66+
}
67+
}
68+
#endregion
69+
}
70+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
5+
namespace SequenceExamples
6+
{
7+
class Program
8+
{
9+
// This part is just for testing the examples
10+
static void Main(string[] args)
11+
{
12+
MinBy.MinByKeySelectorExample();
13+
MinBy.MinByComparerExample();
14+
}
15+
16+
#region MinBy
17+
static class MinBy
18+
{
19+
public static void MinByKeySelectorExample()
20+
{
21+
// <Snippet210>
22+
(string Name, decimal Salary, int Age)[] employees =
23+
{
24+
("Mahmoud", 1000m, 22),
25+
("John", 1200m, 28),
26+
("Sara", 2000m, 32),
27+
("Hadi", 1750m, 27),
28+
("Lana", 1500m, 24),
29+
("Luna", 1850m, 33)
30+
};
31+
32+
// Get the youngest employee in the company.
33+
var youngestEmployee = employees.MinBy(employee => employee.Age);
34+
35+
Console.WriteLine($"Name: {youngestEmployee.Name}, Age: {youngestEmployee.Age}, Salary: ${youngestEmployee.Salary}");
36+
37+
/*
38+
This code produces the following output:
39+
40+
Name: Mahmoud, Age: 22, Salary: $1000
41+
*/
42+
// </Snippet210>
43+
}
44+
45+
public static void MinByComparerExample()
46+
{
47+
// <Snippet211>
48+
(string Name, int Quantity)[] inventory =
49+
{
50+
("apple", 10),
51+
("BANANA", 5),
52+
("Cherry", 20)
53+
};
54+
55+
// Find the product with the minimum name alphabetically, ignoring casing differences.
56+
// 'a' is correctly identified as smaller than 'B' when case is ignored.
57+
var minIgnoreCase = inventory.MinBy(item => item.Name, StringComparer.OrdinalIgnoreCase);
58+
Console.WriteLine($"Case-insensitive comparison: {minIgnoreCase.Name}");
59+
60+
/*
61+
This code produces the following output:
62+
63+
Case-insensitive comparison: apple
64+
*/
65+
// </Snippet211>
66+
}
67+
}
68+
#endregion
69+
}
70+
}

xml/System.CodeDom.Compiler/CodeDomProvider.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
<altmember cref="T:System.CodeDom.Compiler.CompilerInfo" />
7878
<altmember cref="T:Microsoft.CSharp.CSharpCodeProvider" />
7979
<altmember cref="T:Microsoft.VisualBasic.VBCodeProvider" />
80-
<altmember cref="T:Microsoft.JScript.JScriptCodeProvider" />
8180
<related type="Article" href="/dotnet/framework/configure-apps/file-schema/compiler/">Compiler and Language Provider Settings Schema</related>
8281
</Docs>
8382
<Members>

xml/System.ComponentModel.Design/DesignerActionListCollection.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,6 @@
576576
<altmember cref="M:System.ComponentModel.Design.DesignerActionListCollection.IndexOf(System.ComponentModel.Design.DesignerActionList)" />
577577
<altmember cref="M:System.ComponentModel.Design.DesignerActionListCollection.Add(System.ComponentModel.Design.DesignerActionList)" />
578578
<altmember cref="M:System.ComponentModel.Design.DesignerActionListCollection.Remove(System.ComponentModel.Design.DesignerActionList)" />
579-
<altmember cref="M:System.ComponentModel.Design.DesignerActionListCollection.OnInsert(System.Int32,System.Object)" />
580579
</Docs>
581580
</Member>
582581
<Member MemberName="Item">

xml/System.ComponentModel.Design/DesignerActionService.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,6 @@
663663
<altmember cref="M:System.ComponentModel.Design.DesignerActionService.GetComponentServiceActions(System.ComponentModel.IComponent,System.ComponentModel.Design.DesignerActionListCollection)" />
664664
<altmember cref="T:System.ComponentModel.Design.DesignerActionListCollection" />
665665
<altmember cref="T:System.ComponentModel.Design.DesignerVerb" />
666-
<altmember cref="T:System.ComponentModel.Design.ComponentActionsType" />
667666
</Docs>
668667
</Member>
669668
<Member MemberName="GetComponentActions">

xml/System.ComponentModel/RunInstallerAttribute.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
]]></format>
8585
</remarks>
8686
<altmember cref="T:System.Attribute" />
87-
<altmember cref="T:System.Configuration.Install.Installer" />
8887
</Docs>
8988
<Members>
9089
<Member MemberName=".ctor">

xml/System.Configuration/AppSettingsSection.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
]]></format>
5454
</remarks>
5555
<altmember cref="T:System.Configuration.ConfigurationManager" />
56-
<altmember cref="T:System.Web.Configuration.WebConfigurationManager" />
5756
</Docs>
5857
<Members>
5958
<Member MemberName=".ctor">

xml/System.Configuration/Configuration.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ Note: If you use a static <see langword="GetSection" /> method that takes a path
9292
</block>
9393
<altmember cref="T:System.Configuration.ConfigurationSection" />
9494
<altmember cref="T:System.Configuration.ConfigurationManager" />
95-
<altmember cref="T:System.Web.Configuration.WebConfigurationManager" />
9695
<related type="Article" href="/dotnet/framework/configure-apps/">Configuration Files</related>
9796
</Docs>
9897
<Members>

0 commit comments

Comments
 (0)