Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
70 changes: 70 additions & 0 deletions snippets/csharp/System.Linq/Enumerable/MaxBy/enumerable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace SequenceExamples
{
class Program
{
// This part is just for testing the examples
static void Main(string[] args)
{
MaxBy.MaxByKeySelectorExample();
MaxBy.MaxByComparerExample();
}

#region MaxBy
static class MaxBy
{
public static void MaxByKeySelectorExample()
{
// <Snippet212>
(string Name, decimal Salary, int Age)[] employees =
{
("Mahmoud", 1000m, 22),
("John", 1200m, 28),
("Sara", 2000m, 32),
("Hadi", 1750m, 27),
("Lana", 1500m, 24),
("Luna", 1850m, 33)
};

// Get the oldest employee in the company.
var oldestEmployee = employees.MaxBy(employee => employee.Age);

Console.WriteLine($"Name: {oldestEmployee.Name}, Age: {oldestEmployee.Age}, Salary: ${oldestEmployee.Salary}");

/*
This code produces the following output:

Name: Luna, Age: 33, Salary: $1850
*/
// </Snippet212>
}

public static void MaxByComparerExample()
{
// <Snippet213>
(string Name, int Quantity)[] inventory =
{
("apple", 10),
("BANANA", 5),
("Cherry", 20)
};

// Find the product with the maximum name alphabetically, ignoring casing differences.
// 'C' is correctly identified as greater than 'a' and 'B' when case is ignored.
var maxIgnoreCase = inventory.MaxBy(item => item.Name, StringComparer.OrdinalIgnoreCase);
Console.WriteLine($"Case-insensitive comparison: {maxIgnoreCase.Name}");

/*
This code produces the following output:

Case-insensitive comparison: Cherry
*/
// </Snippet213>
}
}
#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
70 changes: 70 additions & 0 deletions snippets/csharp/System.Linq/Enumerable/MinBy/enumerable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace SequenceExamples
{
class Program
{
// This part is just for testing the examples
static void Main(string[] args)
{
MinBy.MinByKeySelectorExample();
MinBy.MinByComparerExample();
}

#region MinBy
static class MinBy
{
public static void MinByKeySelectorExample()
{
// <Snippet210>
(string Name, decimal Salary, int Age)[] employees =
{
("Mahmoud", 1000m, 22),
("John", 1200m, 28),
("Sara", 2000m, 32),
("Hadi", 1750m, 27),
("Lana", 1500m, 24),
("Luna", 1850m, 33)
};

// Get the youngest employee in the company.
var youngestEmployee = employees.MinBy(employee => employee.Age);

Console.WriteLine($"Name: {youngestEmployee.Name}, Age: {youngestEmployee.Age}, Salary: ${youngestEmployee.Salary}");

/*
This code produces the following output:

Name: Mahmoud, Age: 22, Salary: $1000
*/
// </Snippet210>
}

public static void MinByComparerExample()
{
// <Snippet211>
(string Name, int Quantity)[] inventory =
{
("apple", 10),
("BANANA", 5),
("Cherry", 20)
};

// Find the product with the minimum name alphabetically, ignoring casing differences.
// 'a' is correctly identified as smaller than 'B' when case is ignored.
var minIgnoreCase = inventory.MinBy(item => item.Name, StringComparer.OrdinalIgnoreCase);
Console.WriteLine($"Case-insensitive comparison: {minIgnoreCase.Name}");

/*
This code produces the following output:

Case-insensitive comparison: apple
*/
// </Snippet211>
}
}
#endregion
}
}
1 change: 0 additions & 1 deletion xml/System.CodeDom.Compiler/CodeDomProvider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
<altmember cref="T:System.CodeDom.Compiler.CompilerInfo" />
<altmember cref="T:Microsoft.CSharp.CSharpCodeProvider" />
<altmember cref="T:Microsoft.VisualBasic.VBCodeProvider" />
<altmember cref="T:Microsoft.JScript.JScriptCodeProvider" />
<related type="Article" href="/dotnet/framework/configure-apps/file-schema/compiler/">Compiler and Language Provider Settings Schema</related>
</Docs>
<Members>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@
<altmember cref="M:System.ComponentModel.Design.DesignerActionListCollection.IndexOf(System.ComponentModel.Design.DesignerActionList)" />
<altmember cref="M:System.ComponentModel.Design.DesignerActionListCollection.Add(System.ComponentModel.Design.DesignerActionList)" />
<altmember cref="M:System.ComponentModel.Design.DesignerActionListCollection.Remove(System.ComponentModel.Design.DesignerActionList)" />
<altmember cref="M:System.ComponentModel.Design.DesignerActionListCollection.OnInsert(System.Int32,System.Object)" />
</Docs>
</Member>
<Member MemberName="Item">
Expand Down
1 change: 0 additions & 1 deletion xml/System.ComponentModel.Design/DesignerActionService.xml
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@
<altmember cref="M:System.ComponentModel.Design.DesignerActionService.GetComponentServiceActions(System.ComponentModel.IComponent,System.ComponentModel.Design.DesignerActionListCollection)" />
<altmember cref="T:System.ComponentModel.Design.DesignerActionListCollection" />
<altmember cref="T:System.ComponentModel.Design.DesignerVerb" />
<altmember cref="T:System.ComponentModel.Design.ComponentActionsType" />
</Docs>
</Member>
<Member MemberName="GetComponentActions">
Expand Down
1 change: 0 additions & 1 deletion xml/System.ComponentModel/RunInstallerAttribute.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
]]></format>
</remarks>
<altmember cref="T:System.Attribute" />
<altmember cref="T:System.Configuration.Install.Installer" />
</Docs>
<Members>
<Member MemberName=".ctor">
Expand Down
1 change: 0 additions & 1 deletion xml/System.Configuration/AppSettingsSection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
]]></format>
</remarks>
<altmember cref="T:System.Configuration.ConfigurationManager" />
<altmember cref="T:System.Web.Configuration.WebConfigurationManager" />
</Docs>
<Members>
<Member MemberName=".ctor">
Expand Down
1 change: 0 additions & 1 deletion xml/System.Configuration/Configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Note: If you use a static <see langword="GetSection" /> method that takes a path
</block>
<altmember cref="T:System.Configuration.ConfigurationSection" />
<altmember cref="T:System.Configuration.ConfigurationManager" />
<altmember cref="T:System.Web.Configuration.WebConfigurationManager" />
<related type="Article" href="/dotnet/framework/configure-apps/">Configuration Files</related>
</Docs>
<Members>
Expand Down
1 change: 0 additions & 1 deletion xml/System.Configuration/ConfigurationElement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
- The simpler declarative model, also called the attributed model, allows you to define an element attribute by using a property and then decorate it with attributes. These attributes instruct the ASP.NET configuration system about the property types and their default values. With this information, obtained through reflection, the ASP.NET configuration system creates the element property objects for you and performs the required initialization. The example shown later in this topic shows how to use this model.</para>
</block>
<altmember cref="T:System.Configuration.ConfigurationManager" />
<altmember cref="T:System.Web.Configuration.WebConfigurationManager" />
<altmember cref="T:System.Configuration.ConfigurationSection" />
<altmember cref="T:System.Configuration.ElementInformation" />
<altmember cref="T:System.Configuration.ConfigurationElementCollection" />
Expand Down
1 change: 0 additions & 1 deletion xml/System.Configuration/ConfigurationFileMap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

]]></format>
</remarks>
<altmember cref="T:System.Web.Configuration.WebConfigurationFileMap" />
<altmember cref="T:System.Configuration.ExeConfigurationFileMap" />
</Docs>
<Members>
Expand Down
1 change: 0 additions & 1 deletion xml/System.Configuration/ConfigurationManager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ End Module
- Read permissions on all the configuration files.</para>
</block>
<altmember cref="T:System.Configuration.Configuration" />
<altmember cref="T:System.Web.Configuration.WebConfigurationManager" />
<related type="Article" href="/dotnet/framework/configure-apps/">Configuration Files</related>
</Docs>
<Members>
Expand Down
2 changes: 0 additions & 2 deletions xml/System.Configuration/ContextInformation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(System.String)" />
</Docs>
</Member>
<Member MemberName="HostingContext">
Expand Down Expand Up @@ -143,7 +142,6 @@

]]></format>
</remarks>
<altmember cref="T:System.Web.Configuration.WebContext" />
<altmember cref="T:System.Configuration.ExeContext" />
</Docs>
</Member>
Expand Down
1 change: 0 additions & 1 deletion xml/System.Configuration/ExeConfigurationFileMap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
]]></format>
</remarks>
<altmember cref="T:System.Configuration.ConfigurationFileMap" />
<altmember cref="T:System.Web.Configuration.WebConfigurationFileMap" />
<related type="Article" href="/dotnet/framework/configure-apps/">Configuration Files</related>
</Docs>
<Members>
Expand Down
2 changes: 0 additions & 2 deletions xml/System.Data.Common/DbDataSourceEnumerator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

]]></format>
</remarks>
<altmember cref="T:System.Data.Sql.SqlDataSourceEnumerator" />
<related type="Article" href="/dotnet/framework/data/adonet/ado-net-overview">ADO.NET Overview</related>
</Docs>
<Members>
Expand Down Expand Up @@ -156,7 +155,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Data.Sql.SqlDataSourceEnumerator.GetDataSources" />
<related type="Article" href="/dotnet/framework/data/adonet/ado-net-overview">ADO.NET Overview</related>
</Docs>
</Member>
Expand Down
1 change: 0 additions & 1 deletion xml/System.Data.Common/RowUpdatingEventArgs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
]]></format>
</remarks>
<altmember cref="T:System.Data.OleDb.OleDbRowUpdatingEventArgs" />
<altmember cref="T:System.Data.SqlClient.SqlRowUpdatingEventArgs" />
<related type="Article" href="/dotnet/framework/data/adonet/ado-net-overview">ADO.NET Overview</related>
</Docs>
<Members>
Expand Down
1 change: 0 additions & 1 deletion xml/System.Data.Linq.Mapping/MetaAccessor`2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<typeparam name="TMember">The type of the member of that source.</typeparam>
<summary>A strongly typed version of the <see cref="T:System.Data.Linq.Mapping.MetaAccessor" /> class.</summary>
<remarks>To be added.</remarks>
<altmember cref="T:System.Data.Linq.Mapping.MetaAccessor" />
</Docs>
<Members>
<Member MemberName=".ctor">
Expand Down
2 changes: 0 additions & 2 deletions xml/System.Data.Linq/Link`1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

]]></format>
</remarks>
<altmember cref="T:System.Data.Linq.EntityRef`1" />
<altmember cref="T:System.Data.Linq.EntitySet`1" />
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
Expand Down
8 changes: 0 additions & 8 deletions xml/System.Data.Objects/ObjectSet`1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Data.Objects.ObjectContext.AddObject(System.String,System.Object)" />
</Docs>
</Member>
<Member MemberName="ApplyCurrentValues">
Expand Down Expand Up @@ -121,8 +120,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Data.Objects.ObjectStateEntry.ApplyCurrentValues(System.Object)" />
<altmember cref="M:System.Data.Objects.ObjectContext.ApplyCurrentValues``1(System.String,``0)" />
</Docs>
</Member>
<Member MemberName="ApplyOriginalValues">
Expand Down Expand Up @@ -155,8 +152,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Data.Objects.ObjectStateEntry.ApplyOriginalValues(System.Object)" />
<altmember cref="M:System.Data.Objects.ObjectContext.ApplyOriginalValues``1(System.String,``0)" />
</Docs>
</Member>
<Member MemberName="Attach">
Expand Down Expand Up @@ -191,7 +186,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Data.Objects.ObjectContext.AttachTo(System.String,System.Object)" />
</Docs>
</Member>
<Member MemberName="CreateObject">
Expand Down Expand Up @@ -279,7 +273,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Data.Objects.ObjectContext.DeleteObject(System.Object)" />
</Docs>
</Member>
<Member MemberName="Detach">
Expand Down Expand Up @@ -314,7 +307,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Data.Objects.ObjectContext.Detach(System.Object)" />
</Docs>
</Member>
<Member MemberName="EntitySet">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Diagnostics.Eventing.EventProvider.GetLastWriteEventError" />
</Docs>
<Members>
<Member MemberName="EventTooBig">
Expand Down
1 change: 0 additions & 1 deletion xml/System.Diagnostics.SymbolStore/ISymbolWriter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@

]]></format>
</remarks>
<altmember cref="M:System.Reflection.Emit.ModuleBuilder.GetSymWriter" />
</Docs>
<Members>
<Member MemberName="Close">
Expand Down
2 changes: 0 additions & 2 deletions xml/System.Diagnostics/EventInstance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ SVC_UPDATE.EXE
<altmember cref="Overload:System.Diagnostics.EventLog.WriteEvent" />
<altmember cref="P:System.Diagnostics.EventLogEntry.CategoryNumber" />
<altmember cref="P:System.Diagnostics.EventSourceCreationData.CategoryResourceFile" />
<altmember cref="P:System.Diagnostics.EventLogInstaller.CategoryResourceFile" />
</Docs>
</Member>
<Member MemberName="EntryType">
Expand Down Expand Up @@ -1071,7 +1070,6 @@ SVC_UPDATE.EXE
<altmember cref="Overload:System.Diagnostics.EventLog.WriteEvent" />
<altmember cref="P:System.Diagnostics.EventLogEntry.InstanceId" />
<altmember cref="P:System.Diagnostics.EventSourceCreationData.MessageResourceFile" />
<altmember cref="P:System.Diagnostics.EventLogInstaller.MessageResourceFile" />
</Docs>
</Member>
</Members>
Expand Down
2 changes: 0 additions & 2 deletions xml/System.Diagnostics/EventLog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@

]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.EventLogInstaller" />
<altmember cref="T:System.Diagnostics.EventLogEntry" />
<altmember cref="T:System.Diagnostics.EntryWrittenEventArgs" />
<altmember cref="T:System.ServiceProcess.ServiceBase" />
Expand Down Expand Up @@ -851,7 +850,6 @@ SVC_UPDATE.EXE
<altmember cref="M:System.Diagnostics.EventLog.SourceExists(System.String)" />
<altmember cref="M:System.Diagnostics.EventLog.DeleteEventSource(System.String)" />
<altmember cref="P:System.Diagnostics.EventLog.Source" />
<altmember cref="T:System.Diagnostics.EventLogInstaller" />
</Docs>
</Member>
<Member MemberName="CreateEventSource">
Expand Down
Loading
Loading