Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
metadata retrieval
(version: 0)
Comparing performance of:
docs.metadata.js vs params.ts vs meta.ts
Created:
8 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <div id="headerAreaHolder" ms.pgarea="header" data-bi-name="header"> <div id="uhfPlaceHolder" class="c-me"></div> </div> <div class="container mainContainer" lang="en-us" dir="ltr" ms.pgarea="body" data-bi-name="body"> <main role="main" ms.cmpgrp="content" data-bi-name="content"> <div id="main"> <h1> <span class="lang-csharp">String</span> Class </h1> <h2 class="hiddenAnchor">Definition</h2> <div class="metadata"> <dl class="attributeList"> <dt>Namespace:</dt> <dd> <span class="lang-csharp"><a class="xref" href="system?view=netframework-4.7" data-linktype="relative-path">System</a></span> </dd> </dl> <dl class="attributeList"> <dt>Assemblies:</dt><dd>System.Runtime.dll, mscorlib.dll, netstandard.dll</dd> </dl> </div> <div class="summaryHolder"> <div class="summary clearFix"> <p>Represents text as a sequence of UTF-16 code units.</p> </div> </div> <nav id="center-doc-outline" class="doc-outline" ms.cmpgrp="intopic toc" data-bi-name="intopic toc" role="navigation" aria-label="On page navigation"> <h3>In This Article</h3> </nav> <pre class="wrap loading"><code class="csharp lang-csharp">[System.Runtime.InteropServices.ComVisible(true)] public sealed class String : ICloneable, IComparable, IComparable<string>, IConvertible, IEquatable<string>, System.Collections.Generic.IEnumerable<char></code></pre> <dl class="attributeList stack"> <dt>Inheritance</dt><dd> <div class="pdlHolder"> <div class="pdl"><span class="lang-csharp"><a class="xref" href="system.object?view=netframework-4.7" data-linktype="relative-path">Object</a></span></div><span class="lang-csharp">String</span> </div> </dd> </dl> <dl class="attributeList stack"> <dt>Attributes</dt><dd> <div class="cdlHolder"> <span class="cdl"><a class="xref" href="system.runtime.interopservices.comvisibleattribute?view=netframework-4.7" title="System.Runtime.InteropServices.ComVisibleAttribute" data-linktype="relative-path">ComVisibleAttribute</a></span> </div> </dd> </dl> <dl class="attributeList stack"> <dt>Implements</dt><dd> <div class="cdlHolder"> <span class="cdl"><span class="lang-csharp"><a class="xref" href="system.collections.generic.ienumerable-1?view=netframework-4.7" data-linktype="relative-path">IEnumerable</a><<a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a>></span></span> <span class="cdl"><span class="lang-csharp"><a class="xref" href="system.icloneable?view=netframework-4.7" data-linktype="relative-path">ICloneable</a></span></span> <span class="cdl"><span class="lang-csharp"><a class="xref" href="system.icomparable?view=netframework-4.7" data-linktype="relative-path">IComparable</a></span></span> <span class="cdl"><span class="lang-csharp"><a class="xref" href="system.icomparable-1?view=netframework-4.7" data-linktype="relative-path">IComparable</a><<a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>></span></span> <span class="cdl"><span class="lang-csharp"><a class="xref" href="system.iconvertible?view=netframework-4.7" data-linktype="relative-path">IConvertible</a></span></span> <span class="cdl"><span class="lang-csharp"><a class="xref" href="system.iequatable-1?view=netframework-4.7" data-linktype="relative-path">IEquatable</a><<a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>></span></span> </div> </dd> </dl> <h3 class="accented">Inherited Members</h3> <h4 class="accented">System.Object</h4> <div class="cdlHolder"> <div class="cdl"><span class="lang-csharp"><a class="xref" href="system.object.equals?view=netframework-4.7#System_Object_Equals_System_Object_System_Object_" data-linktype="relative-path">Equals(Object, Object)</a></span></div> <div class="cdl"><span class="lang-csharp"><a class="xref" href="system.object.gettype?view=netframework-4.7#System_Object_GetType" data-linktype="relative-path">GetType()</a></span></div> <div class="cdl"><span class="lang-csharp"><a class="xref" href="system.object.memberwiseclone?view=netframework-4.7#System_Object_MemberwiseClone" data-linktype="relative-path">MemberwiseClone()</a></span></div> <div class="cdl"><span class="lang-csharp"><a class="xref" href="system.object.referenceequals?view=netframework-4.7#System_Object_ReferenceEquals_System_Object_System_Object_" data-linktype="relative-path">ReferenceEquals(Object, Object)</a></span></div> </div> <h2 class="accented">Remarks</h2> <div class="NOTE"><h5>Note</h5><p> To view the .NET Framework source code for this type, see the <a href="http://referencesource.microsoft.com/#mscorlib/system/string.cs#8281103e6f23cb5c" data-linktype="external">Reference Source</a>. You can browse through the source code online, download the reference for offline viewing, and step through the sources (including patches and updates) during debugging; see <a href="http://referencesource.microsoft.com/" data-linktype="external">instructions</a>. </p> </div> <p> A string is a sequential collection of characters that is used to represent text. A <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object is a sequential collection of <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">System.Char</a> objects that represent a string; a <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">System.Char</a> object corresponds to a UTF-16 code unit. The value of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object is the content of the sequential collection of <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">System.Char</a> objects, and that value is immutable (that is, it is read-only). For more information about the immutability of strings, see the <a href="#Immutability" data-linktype="self-bookmark">Immutability and the StringBuilder class</a> section later in this topic. The maximum size of a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object in memory is 2GB, or about 1 billion characters. </p> <p> In this section: </p> <p> <a href="#Instantiation" data-linktype="self-bookmark">Instantiating a String object</a><br> <a href="#Characters" data-linktype="self-bookmark">Char objects and Unicode characters</a><br> <a href="#Unicode" data-linktype="self-bookmark">Strings and The Unicode Standard</a><br> <a href="#EmbeddedNulls" data-linktype="self-bookmark">Strings and embedded null characters</a><br> <a href="#Indexes" data-linktype="self-bookmark">Strings and indexes</a><br> <a href="#Nulls" data-linktype="self-bookmark">Null strings and empty strings</a><br> <a href="#Immutability" data-linktype="self-bookmark">Immutability and the StringBuilder class</a><br> <a href="#CultureSensitive" data-linktype="self-bookmark">Ordinal vs. culture-sensitive operations</a><br> <a href="#Normalization" data-linktype="self-bookmark">Normalization</a><br> <a href="#ByCategory" data-linktype="self-bookmark">String operations by category</a> </p> <p><a name="Instantiation"></a> </p> <h3 class="accented" id="instantiating-a-string-object">Instantiating a String object</h3> <p> You can instantiate a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object in the following ways: </p> <ul> <li><p>By assigning a string literal to a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> variable. This is the most commonly used method for creating a string. The following example uses assignment to create several strings. Note that in C#, because the backslash (\) is an escape character, literal backslashes in a string must be escaped or the entire string must be @-quoted. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.class.instantiate/cpp/string.instantiate1.cpp" name="System.String.Class.Instantiate#1">using namespace System; void main() { String^ string1 = "This is a string created by assignment."; Console::WriteLine(string1); String^ string2a = "The path is C:\\PublicDocuments\\Report1.doc"; Console::WriteLine(string2a); } // The example displays the following output: // This is a string created by assignment. // The path is C:\PublicDocuments\Report1.doc </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.class.instantiate/cs/program.cs" name="System.String.Class.Instantiate#1">string string1 = "This is a string created by assignment."; Console.WriteLine(string1); string string2a = "The path is C:\\PublicDocuments\\Report1.doc"; Console.WriteLine(string2a); string string2b = @"The path is C:\PublicDocuments\Report1.doc"; Console.WriteLine(string2b); // The example displays the following output: // This is a string created by assignment. // The path is C:\PublicDocuments\Report1.doc // The path is C:\PublicDocuments\Report1.doc </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.class.instantiate/vb/instantiate1.vb" name="System.String.Class.Instantiate#1">Dim string1 As String = "This is a string created by assignment." Console.WriteLine(string1) Dim string2 As String = "The path is C:\PublicDocuments\Report1.doc" Console.WriteLine(string2) ' The example displays the following output: ' This is a string created by assignment. ' The path is C:\PublicDocuments\Report1.doc </code></pre></li> <li><p>By calling a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class constructor. The following example instantiates strings by calling several class constructors. Note that some of the constructors include pointers to character arrays or signed byte arrays as parameters. Visual Basic does not support calls to these constructors. For detailed information about <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> constructors, see the <a class="xref" href="system.string.-ctor?view=netframework-4.7" data-linktype="relative-path">String</a> constructor summary. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.class.instantiate/cpp/string.instantiate2.cpp" name="System.String.Class.Instantiate#2">using namespace System; void main() { wchar_t chars[5] = L"word"; char bytes[6] = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x00 }; // Create a string from a character array. String^ string1 = gcnew String(chars); Console::WriteLine(string1); // Create a string that consists of a character repeated 20 times. String^ string2 = gcnew String('c', 20); Console::WriteLine(string2); String^ stringFromBytes = nullptr; String^ stringFromChars = nullptr; char * pbytes = &bytes[0]; // Create a string from a pointer to a signed byte array. stringFromBytes = gcnew String(pbytes); wchar_t* pchars = &chars[0]; // Create a string from a pointer to a character array. stringFromChars = gcnew String(pchars); Console::WriteLine(stringFromBytes); Console::WriteLine(stringFromChars); Console::ReadLine(); } // The example displays the following output: // word // cccccccccccccccccccc // ABCDE // word </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.class.instantiate/cs/program.cs" name="System.String.Class.Instantiate#2">char[] chars = { 'w', 'o', 'r', 'd' }; sbyte[] bytes = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x00 }; // Create a string from a character array. string string1 = new string(chars); Console.WriteLine(string1); // Create a string that consists of a character repeated 20 times. string string2 = new string('c', 20); Console.WriteLine(string2); string stringFromBytes = null; string stringFromChars = null; unsafe { fixed (sbyte* pbytes = bytes) { // Create a string from a pointer to a signed byte array. stringFromBytes = new string(pbytes); } fixed (char* pchars = chars) { // Create a string from a pointer to a character array. stringFromChars = new string(pchars); } } Console.WriteLine(stringFromBytes); Console.WriteLine(stringFromChars); // The example displays the following output: // word // cccccccccccccccccccc // ABCDE // word </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.class.instantiate/vb/instantiate1.vb" name="System.String.Class.Instantiate#2">Dim chars() As Char = { "w"c, "o"c, "r"c, "d"c } ' Create a string from a character array. Dim string1 As New String(chars) Console.WriteLine(string1) ' Create a string that consists of a character repeated 20 times. Dim string2 As New String("c"c, 20) Console.WriteLine(string2) ' The example displays the following output: ' word ' cccccccccccccccccccc </code></pre></li> <li><p>By using the string concatenation operator (+ in C# and & or + in Visual Basic) to create a single string from any combination of <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> instances and string literals. The following example illustrates the use of the string concatenation operator. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.class.instantiate/cpp/string.instantiate3.cpp" name="System.String.Class.Instantiate#3">String^ string1 = "Today is " + DateTime::Now.ToString("D") + "."; Console::WriteLine(string1); String^ string2 = "This is one sentence. " + "This is a second. "; string2 += "This is a third sentence."; Console::WriteLine(string2); // The example displays output like the following: // Today is Tuesday, July 06, 2011. // This is one sentence. This is a second. This is a third sentence. </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.class.instantiate/cs/program.cs" name="System.String.Class.Instantiate#3">string string1 = "Today is " + DateTime.Now.ToString("D") + "."; Console.WriteLine(string1); string string2 = "This is one sentence. " + "This is a second. "; string2 += "This is a third sentence."; Console.WriteLine(string2); // The example displays output like the following: // Today is Tuesday, July 06, 2011. // This is one sentence. This is a second. This is a third sentence. </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.class.instantiate/vb/instantiate1.vb" name="System.String.Class.Instantiate#3">Dim string1 As String = "Today is " + Date.Now.ToString("D") + "." Console.WriteLine(string1) Dim string2 As String = "This is one sentence. " + "This is a second. " string2 += "This is a third sentence." Console.WriteLine(string2) ' The example displays output like the following: ' Today is Tuesday, July 06, 2011. ' This is one sentence. This is a second. This is a third sentence. </code></pre></li> <li><p>By retrieving a property or calling a method that returns a string. The following example uses the methods of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class to extract a substring from a larger string. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.class.instantiate/cpp/string.instantiate3.cpp" name="System.String.Class.Instantiate#4">String^ sentence = "This sentence has five words."; // Extract the second word. int startPosition = sentence->IndexOf(" ") + 1; String^ word2 = sentence->Substring(startPosition, sentence->IndexOf(" ", startPosition) - startPosition); Console::WriteLine("Second word: " + word2); </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.class.instantiate/cs/program.cs" name="System.String.Class.Instantiate#4">string sentence = "This sentence has five words."; // Extract the second word. int startPosition = sentence.IndexOf(" ") + 1; string word2 = sentence.Substring(startPosition, sentence.IndexOf(" ", startPosition) - startPosition); Console.WriteLine("Second word: " + word2); // The example displays the following output: // Second word: sentence </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.class.instantiate/vb/instantiate1.vb" name="System.String.Class.Instantiate#4">Dim sentence As String = "This sentence has five words." ' Extract the second word. Dim startPosition As Integer = sentence.IndexOf(" ") + 1 Dim word2 As String = sentence.Substring(startPosition, sentence.IndexOf(" ", startPosition) - startPosition) Console.WriteLine("Second word: " + word2) ' The example displays the following output: ' Second word: sentence </code></pre></li> <li><p>By calling a formatting method to convert a value or object to its string representation. The following example uses the <a href="../standard/base-types/composite-formatting?view=netframework-4.7" data-linktype="relative-path">composite formatting</a> feature to embed the string representation of two objects into a string. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.class.instantiate/cpp/string.instantiate3.cpp" name="System.String.Class.Instantiate#5">DateTime^ dateAndTime = gcnew DateTime(2011, 7, 6, 7, 32, 0); Double temperature = 68.3; String^ result = String::Format("At {0:t} on {0:D}, the temperature was {1:F1} degrees Fahrenheit.", dateAndTime, temperature); Console::WriteLine(result); // The example displays the following output: // At 7:32 AM on Wednesday, July 06, 2011, the temperature was 68.3 degrees Fahrenheit. </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.class.instantiate/cs/program.cs" name="System.String.Class.Instantiate#5">DateTime dateAndTime = new DateTime(2011, 7, 6, 7, 32, 0); double temperature = 68.3; string result = String.Format("At {0:t} on {0:D}, the temperature was {1:F1} degrees Fahrenheit.", dateAndTime, temperature); Console.WriteLine(result); // The example displays the following output: // At 7:32 AM on Wednesday, July 06, 2011, the temperature was 68.3 degrees Fahrenheit. </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.class.instantiate/vb/instantiate1.vb" name="System.String.Class.Instantiate#5">Dim dateAndTime As DateTime = #07/06/2011 7:32:00AM# Dim temperature As Double = 68.3 Dim result As String = String.Format("At {0:t} on {0:D}, the temperature was {1:F1} degrees Fahrenheit.", dateAndTime, temperature) Console.WriteLine(result) ' The example displays the following output: ' At 7:32 AM on Wednesday, July 06, 2011, the temperature was 68.3 degrees Fahrenheit. </code></pre></li> </ul> <p><a name="Characters"></a> </p> <h3 class="accented" id="char-objects-and-unicode-characters">Char objects and Unicode characters</h3> <p> Each character in a string is defined by a Unicode scalar value, also called a Unicode code point or the ordinal (numeric) value of the Unicode character. Each code point is encoded by using UTF-16 encoding, and the numeric value of each element of the encoding is represented by a <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object. </p> <div class="NOTE"><h5>Note</h5><p> Note that, because a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> instance consists of a sequential collection of UTF-16 code units, it is possible to create a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object that is not a well-formed Unicode string. For example, it is possible to create a string that has a low surrogate without a corresponding high surrogate. Although some methods, such as the methods of encoding and decoding objects in the <a class="xref" href="system.text?view=netframework-4.7" data-linktype="relative-path">System.Text</a> namespace, may performs checks to ensure that strings are well-formed, <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class members do not ensure that a string is well-formed. </p> </div> <p> A single <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object usually represents a single code point; that is, the numeric value of the <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> equals the code point. For example, the code point for the character "a" is U+0061. However, a code point might require more than one encoded element (more than one <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object). The Unicode standard defines two types of characters that correspond to multiple <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> objects: graphemes, and Unicode supplementary code points that correspond to characters in the Unicode supplementary planes. </p> <ul> <li><p>A grapheme is represented by a base character followed by one or more combining characters. For example, the character ä is represented by a <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object whose code point is U+0061 followed by a <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object whose code point is U+0308. This character can also be defined by a single <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object that has a code point of U+00E4. As the following example shows, a culture-sensitive comparison for equality indicates that these two representations are equal, although an ordinary ordinal comparison does not. However, if the two strings are normalized, an ordinal comparison also indicates that they are equal. (For more information on normalizing strings, see the <a href="#Normalization" data-linktype="self-bookmark">Normalization</a> section.) </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.char1.cpp" name="System.String.Class#2">using namespace System; using namespace System::Globalization; using namespace System::IO; void main() { StreamWriter^ sw = gcnew StreamWriter(".\\graphemes.txt"); String^ grapheme = L"a" + L"\u0308"; sw->WriteLine(grapheme); String^ singleChar = "\u00e4"; sw->WriteLine(singleChar); sw->WriteLine("{0} = {1} (Culture-sensitive): {2}", grapheme, singleChar, String::Equals(grapheme, singleChar, StringComparison::CurrentCulture)); sw->WriteLine("{0} = {1} (Ordinal): {2}", grapheme, singleChar, String::Equals(grapheme, singleChar, StringComparison::Ordinal)); sw->WriteLine("{0} = {1} (Normalized Ordinal): {2}", grapheme, singleChar, String::Equals(grapheme->Normalize(), singleChar->Normalize(), StringComparison::Ordinal)); sw->Close(); } // The example produces the following output: // ä // ä // ä = ä (Culture-sensitive): True // ä = ä (Ordinal): False // ä = ä (Normalized Ordinal): True </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/grapheme1.cs" name="System.String.Class#2">using System; using System.Globalization; using System.IO; public class Example { public static void Main() { StreamWriter sw = new StreamWriter(@".\graphemes.txt"); string grapheme = "\u0061\u0308"; sw.WriteLine(grapheme); string singleChar = "\u00e4"; sw.WriteLine(singleChar); sw.WriteLine("{0} = {1} (Culture-sensitive): {2}", grapheme, singleChar, String.Equals(grapheme, singleChar, StringComparison.CurrentCulture)); sw.WriteLine("{0} = {1} (Ordinal): {2}", grapheme, singleChar, String.Equals(grapheme, singleChar, StringComparison.Ordinal)); sw.WriteLine("{0} = {1} (Normalized Ordinal): {2}", grapheme, singleChar, String.Equals(grapheme.Normalize(), singleChar.Normalize(), StringComparison.Ordinal)); sw.Close(); } } // The example produces the following output: // ä // ä // ä = ä (Culture-sensitive): True // ä = ä (Ordinal): False // ä = ä (Normalized Ordinal): True </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/grapheme1.vb" name="System.String.Class#2">Imports System.Globalization Imports System.IO Module Example Public Sub Main() Dim sw As New StreamWriter(".\graphemes.txt") Dim grapheme As String = ChrW(&H0061) + ChrW(&h0308) sw.WriteLine(grapheme) Dim singleChar As String = ChrW(&h00e4) sw.WriteLine(singleChar) sw.WriteLine("{0} = {1} (Culture-sensitive): {2}", grapheme, singleChar, String.Equals(grapheme, singleChar, StringComparison.CurrentCulture)) sw.WriteLine("{0} = {1} (Ordinal): {2}", grapheme, singleChar, String.Equals(grapheme, singleChar, StringComparison.Ordinal)) sw.WriteLine("{0} = {1} (Normalized Ordinal): {2}", grapheme, singleChar, String.Equals(grapheme.Normalize(), singleChar.Normalize(), StringComparison.Ordinal)) sw.Close() End Sub End Module ' The example produces the following output: ' ä ' ä ' ä = ä (Culture-sensitive): True ' ä = ä (Ordinal): False ' ä = ä (Normalized Ordinal): True </code></pre></li> <li><p>A Unicode supplementary code point (a surrogate pair) is represented by a <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object whose code point is a high surrogate followed by a <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object whose code point is a low surrogate. The code units of high surrogates range from U+D800 to U+DBFF. The code units of low surrogates range from U+DC00 to U+DFFF. Surrogate pairs are used to represent characters in the 16 Unicode supplementary planes. The following example creates a surrogate character and passes it to the <a class="xref" href="system.char.issurrogatepair?view=netframework-4.7#System_Char_IsSurrogatePair_System_Char_System_Char_" data-linktype="relative-path">System.Char.IsSurrogatePair(Char, Char)</a> method to determine whether it is a surrogate pair. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.char2.cpp" name="System.String.Class#3">using namespace System; void main() { String^ surrogate = L"\xD800\xDC03" ; for (int ctr = 0; ctr < surrogate->Length; ctr++) Console::Write("U+{0:X4} ", Convert::ToUInt16(surrogate[ctr])); Console::WriteLine(); Console::WriteLine(" Is Surrogate Pair: {0}", Char::IsSurrogatePair(surrogate[0], surrogate[1])); Console::ReadLine(); } // The example displays the following output: // U+D800 U+DC03 // Is Surrogate Pair: True </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/surrogate1.cs" name="System.String.Class#3">using System; public class Example { public static void Main() { string surrogate = "\uD800\uDC03"; for (int ctr = 0; ctr < surrogate.Length; ctr++) Console.Write("U+{0:X2} ", Convert.ToUInt16(surrogate[ctr])); Console.WriteLine(); Console.WriteLine(" Is Surrogate Pair: {0}", Char.IsSurrogatePair(surrogate[0], surrogate[1])); } } // The example displays the following output: // U+D800 U+DC03 // Is Surrogate Pair: True </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/surrogate1.vb" name="System.String.Class#3">Module Example Public Sub Main() Dim surrogate As String = ChrW(&hD800) + ChrW(&hDC03) For ctr As Integer = 0 To surrogate.Length - 1 Console.Write("U+{0:X2} ", Convert.ToUInt16(surrogate(ctr))) Next Console.WriteLine() Console.WriteLine(" Is Surrogate Pair: {0}", Char.IsSurrogatePair(surrogate(0), surrogate(1))) End Sub End Module ' The example displays the following output: ' U+D800 U+DC03 ' Is Surrogate Pair: True </code></pre></li> </ul> <p><a name="Unicode"></a> </p> <h3 class="accented" id="strings-and-the-unicode-standard">Strings and The Unicode Standard</h3> <p> Characters in a string are represented by UTF-16 encoded code units, which correspond to <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> values. </p> <p> Each character in a string has an associated Unicode character category, which is represented in the .NET Framework by the <a class="xref" href="system.globalization.unicodecategory?view=netframework-4.7" data-linktype="relative-path">UnicodeCategory</a> enumeration. The category of a character or a surrogate pair can be determined by calling the <a class="xref" href="system.globalization.charunicodeinfo.getunicodecategory?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CharUnicodeInfo.GetUnicodeCategory</a> method. </p> <p> The .NET Framework maintains its own table of characters and their corresponding categories, which ensures that a version of the .NET Framework running on different platforms returns identical character category information. The following table lists the versions of the .NET Framework and the versions of the Unicode Standard on which their character categories are based. </p> <table> <thead> <tr> <th>.NET Framework version</th> <th>Version of the Unicode Standard</th> </tr> </thead> <tbody> <tr> <td>.NET Framework 1.1</td> <td><a href="http://www.unicode.org/versions/Unicode4.0.0/" data-linktype="external">The Unicode Standard, Version 4.0.0</a></td> </tr> <tr> <td>The .NET Framework 2.0</td> <td><a href="http://www.unicode.org/versions/Unicode5.0.0" data-linktype="external">The Unicode Standard, Version 5.0.0</a></td> </tr> <tr> <td> .NET Framework 3.5</td> <td><a href="http://www.unicode.org/versions/Unicode5.0.0" data-linktype="external">The Unicode Standard, Version 5.0.0</a></td> </tr> <tr> <td>.NET Framework 4</td> <td><a href="http://www.unicode.org/versions/Unicode5.0.0" data-linktype="external">The Unicode Standard, Version 5.0.0</a></td> </tr> <tr> <td>.NET Framework 4.5</td> <td><a href="http://www.unicode.org/versions/Unicode6.3.0/" data-linktype="external">The Unicode Standard, Version 6.3.0</a></td> </tr> <tr> <td>.NET Framework 4.5.1</td> <td><a href="http://www.unicode.org/versions/Unicode6.3.0/" data-linktype="external">The Unicode Standard, Version 6.3.0</a></td> </tr> <tr> <td>.NET Framework 4.5.2</td> <td><a href="http://www.unicode.org/versions/Unicode6.3.0/" data-linktype="external">The Unicode Standard, Version 6.3.0</a></td> </tr> <tr> <td>.NET Framework 4.6</td> <td><a href="http://www.unicode.org/versions/Unicode6.3.0/" data-linktype="external">The Unicode Standard, Version 6.3.0</a></td> </tr> <tr> <td>.NET Framework 4.6.1</td> <td><a href="http://www.unicode.org/versions/Unicode6.3.0/" data-linktype="external">The Unicode Standard, Version 6.3.0</a></td> </tr> <tr> <td>.NET Framework 4.6.2</td> <td><a href="http://www.unicode.org/versions/Unicode8.0.0/" data-linktype="external">The Unicode Standard, Version 8.0.0</a></td> </tr> </tbody> </table> <p> In addition, the .NET Framework supports string comparison and sorting based on the Unicode standard. In versions of the .NET Framework through the .NET Framework 4, the .NET Framework maintains its own table of string data. This is also true of versions of the .NET Framework starting with the .NET Framework 4.5 running on Windows 7. Starting with the .NET Framework 4.5 running on Window 8 and later versions of the Windows operating system, the runtime delegates string comparison and sorting operations to the operating system. The following table lists the versions of the .NET Framework and the versions of the Unicode Standard on which character comparison and sorting are based. </p> <table> <thead> <tr> <th>.NET Framework version</th> <th>Version of the Unicode Standard</th> </tr> </thead> <tbody> <tr> <td>.NET Framework 1.1</td> <td><a href="http://www.unicode.org/versions/Unicode4.0.0/" data-linktype="external">The Unicode Standard, Version 4.0.0</a></td> </tr> <tr> <td>The .NET Framework 2.0</td> <td><a href="http://www.unicode.org/versions/Unicode5.0.0" data-linktype="external">The Unicode Standard, Version 5.0.0</a></td> </tr> <tr> <td> .NET Framework 3.5</td> <td><a href="http://www.unicode.org/versions/Unicode5.0.0" data-linktype="external">The Unicode Standard, Version 5.0.0</a></td> </tr> <tr> <td>.NET Framework 4</td> <td><a href="http://www.unicode.org/versions/Unicode5.0.0" data-linktype="external">The Unicode Standard, Version 5.0.0</a></td> </tr> <tr> <td>.NET Framework 4.5 and later on Windows 7</td> <td><a href="http://www.unicode.org/versions/Unicode5.0.0" data-linktype="external">The Unicode Standard, Version 5.0.0</a></td> </tr> <tr> <td>.NET Framework 4.5 and later on Windows 8 and later Windows operating systems</td> <td><a href="http://www.unicode.org/versions/Unicode6.3.0/" data-linktype="external">The Unicode Standard, Version 6.3.0</a></td> </tr> </tbody> </table> <p><a name="EmbeddedNulls"></a> </p> <h3 class="accented" id="strings-and-embedded-null-characters">Strings and embedded null characters</h3> <p> In the .NET Framework, a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object can include embedded null characters, which count as a part of the string's length. However, in some languages such as C and C++, a null character indicates the end of a string;it is not considered a part of the string and is not counted as part of the string's length. This means that the following common assumptions that C and C++ programmers or libraries written in C or C++ might make about strings are not necessarily valid when applied to <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects: </p> <ul> <li><p>The value returned by the <code>strlen</code> or <code>wcslen</code> functions does not necessarily equal <a class="xref" href="system.string.length?view=netframework-4.7" data-linktype="relative-path">System.String.Length</a>. </p> </li> <li><p>The string created by the <code>strcpy_s</code> or <code>wcscpy_s</code> functions is not necessarily identical to the string created by the <a class="xref" href="system.string.copy?view=netframework-4.7" data-linktype="relative-path">System.String.Copy</a> method. </p> </li> </ul> <p> You should ensure that native C and C++ code that instantiates <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects, and code that is passed <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects through platform invoke, do not assume that an embedded null character marks the end of the string. </p> <p> Embedded null characters in a string are also treated differently when a string is sorted (or compared) and when a string is searched. Null characters are ignored when performing culture-sensitive comparisons between two strings, including comparisons using the invariant culture. They are considered only for ordinal or case-insensitive ordinal comparisons. On the other hand, embedded null characters are always considered when searching a string with methods such as <a class="xref" href="system.string.contains?view=netframework-4.7" data-linktype="relative-path">Contains</a>, <a class="xref" href="system.string.startswith?view=netframework-4.7" data-linktype="relative-path">StartsWith</a>, and <a class="xref" href="system.string.indexof?view=netframework-4.7" data-linktype="relative-path">IndexOf</a>. </p> <p><a name="Indexes"></a> </p> <h3 class="accented" id="strings-and-indexes">Strings and indexes</h3> <p> An index is the position of a <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object (not a Unicode character) in a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>. An index is a zero-based, nonnegative number that starts from the first position in the string, which is index position zero. A number of search methods, such as <a class="xref" href="system.string.indexof?view=netframework-4.7" data-linktype="relative-path">IndexOf</a> and <a class="xref" href="system.string.lastindexof?view=netframework-4.7" data-linktype="relative-path">LastIndexOf</a>, return the index of a character or substring in the string instance. </p> <p> The <a class="xref" href="system.string.chars?view=netframework-4.7" data-linktype="relative-path">Chars[Int32]</a> property lets you access individual <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> objects by their index position in the string. Because the <a class="xref" href="system.string.chars?view=netframework-4.7" data-linktype="relative-path">Chars[Int32]</a> property is the default property (in Visual Basic) or the indexer (in C#), you can access the individual <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> objects in a string by using code such as the following. This code looks for white space or punctuation characters in a string to determine how many words the string contains. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.index1.cpp" name="System.String.Class#4">using namespace System; void main() { String^ s1 = "This string consists of a single short sentence."; int nWords = 0; s1 = s1->Trim(); for (int ctr = 0; ctr < s1->Length; ctr++) { if (Char::IsPunctuation(s1[ctr]) | Char::IsWhiteSpace(s1[ctr])) nWords++; } Console::WriteLine("The sentence\n {0}\nhas {1} words.", s1, nWords); } // The example displays the following output: // The sentence // This string consists of a single short sentence. // has 8 words. </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/index1.cs" name="System.String.Class#4">using System; public class Example { public static void Main() { string s1 = "This string consists of a single short sentence."; int nWords = 0; s1 = s1.Trim(); for (int ctr = 0; ctr < s1.Length; ctr++) { if (Char.IsPunctuation(s1[ctr]) | Char.IsWhiteSpace(s1[ctr])) nWords++; } Console.WriteLine("The sentence\n {0}\nhas {1} words.", s1, nWords); } } // The example displays the following output: // The sentence // This string consists of a single short sentence. // has 8 words. </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/index1.vb" name="System.String.Class#4">Module Example Public Sub Main() Dim s1 As String = "This string consists of a single short sentence." Dim nWords As Integer = 0 s1 = s1.Trim() For ctr As Integer = 0 To s1.Length - 1 If Char.IsPunctuation(s1(ctr)) Or Char.IsWhiteSpace(s1(ctr)) nWords += 1 End If Next Console.WriteLine("The sentence{2} {0}{2}has {1} words.", s1, nWords, vbCrLf) End Sub End Module ' The example displays the following output: ' The sentence ' This string consists of a single short sentence. ' has 8 words. </code></pre><p> Because the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class implements the <a class="xref" href="system.collections.ienumerable?view=netframework-4.7" data-linktype="relative-path">IEnumerable</a> interface, you can also iterate through the <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> objects in a string by using a <code>foreach</code> construct, as the following example shows. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.index2.cpp" name="System.String.Class#5">using namespace System; void main() { String^ s1 = "This string consists of a single short sentence."; int nWords = 0; s1 = s1->Trim(); for each (Char ch in s1) { if (Char::IsPunctuation(ch) | Char::IsWhiteSpace(ch)) nWords++; } Console::WriteLine("The sentence\n {0}\nhas {1} words.", s1, nWords); Console::ReadLine(); } // The example displays the following output: // The sentence // This string consists of a single short sentence. // has 8 words. </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/index2.cs" name="System.String.Class#5">using System; public class Example { public static void Main() { string s1 = "This string consists of a single short sentence."; int nWords = 0; s1 = s1.Trim(); foreach (var ch in s1) { if (Char.IsPunctuation(ch) | Char.IsWhiteSpace(ch)) nWords++; } Console.WriteLine("The sentence\n {0}\nhas {1} words.", s1, nWords); } } // The example displays the following output: // The sentence // This string consists of a single short sentence. // has 8 words. </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/index2.vb" name="System.String.Class#5">Module Example Public Sub Main() Dim s1 As String = "This string consists of a single short sentence." Dim nWords As Integer = 0 s1 = s1.Trim() For Each ch In s1 If Char.IsPunctuation(ch) Or Char.IsWhiteSpace(ch) Then nWords += 1 End If Next Console.WriteLine("The sentence{2} {0}{2}has {1} words.", s1, nWords, vbCrLf) End Sub End Module ' The example displays the following output: ' The sentence ' This string consists of a single short sentence. ' has 8 words. </code></pre><p> Consecutive index values might not correspond to consecutive Unicode characters, because a Unicode character might be encoded as more than one <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object. In particular, a string may contain multi-character units of text that are formed by a base character followed by one or more combining characters or by surrogate pairs. To work with Unicode characters instead of <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> objects, use the <a class="xref" href="system.globalization.stringinfo?view=netframework-4.7" data-linktype="relative-path">System.Globalization.StringInfo</a> and <a class="xref" href="system.globalization.textelementenumerator?view=netframework-4.7" data-linktype="relative-path">TextElementEnumerator</a> classes. The following example illustrates the difference between code that works with <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> objects and code that works with Unicode characters. It compares the number of characters or text elements in each word of a sentence. The string includes two sequences of a base character followed by a combining character. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.index3.cpp" name="System.String.Class#6">using namespace System; using namespace System::Collections::Generic; using namespace System::Globalization; void main() { // First sentence of The Mystery of the Yellow Room, by Leroux. String^ opening = L"Ce n'est pas sans une certaine émotion que "+ L"je commence à raconter ici les aventures " + L"extraordinaires de Joseph Rouletabille."; // Character counters. int nChars = 0; // Objects to store word count. List<int>^ chars = gcnew List<int>(); List<int>^ elements = gcnew List<int>(); for each (Char ch in opening) { // Skip the ' character. if (ch == '\x0027') continue; if (Char::IsWhiteSpace(ch) | (Char::IsPunctuation(ch))) { chars->Add(nChars); nChars = 0; } else { nChars++; } } TextElementEnumerator^ te = StringInfo::GetTextElementEnumerator(opening); while (te->MoveNext()) { String^ s = te->GetTextElement(); // Skip the ' character. if (s == "\x0027") continue; if ( String::IsNullOrEmpty(s->Trim()) | (s->Length == 1 && Char::IsPunctuation(Convert::ToChar(s)))) { elements->Add(nChars); nChars = 0; } else { nChars++; } } // Display character counts. Console::WriteLine("{0,6} {1,20} {2,20}", "Word #", "Char Objects", "Characters"); for (int ctr = 0; ctr < chars->Count; ctr++) Console::WriteLine("{0,6} {1,20} {2,20}", ctr, chars[ctr], elements[ctr]); Console::ReadLine(); } // The example displays the following output: // Word # Char Objects Characters // 0 2 2 // 1 4 4 // 2 3 3 // 3 4 4 // 4 3 3 // 5 8 8 // 6 8 7 // 7 3 3 // 8 2 2 // 9 8 8 // 10 2 1 // 11 8 8 // 12 3 3 // 13 3 3 // 14 9 9 // 15 15 15 // 16 2 2 // 17 6 6 // 18 12 12 </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/index3.cs" name="System.String.Class#6">using System; using System.Collections.Generic; using System.Globalization; public class Example { public static void Main() { // First sentence of The Mystery of the Yellow Room, by Leroux. string opening = "Ce n'est pas sans une certaine émotion que "+ "je commence à raconter ici les aventures " + "extraordinaires de Joseph Rouletabille."; // Character counters. int nChars = 0; // Objects to store word count. List<int> chars = new List<int>(); List<int> elements = new List<int>(); foreach (var ch in opening) { // Skip the ' character. if (ch == '\u0027') continue; if (Char.IsWhiteSpace(ch) | (Char.IsPunctuation(ch))) { chars.Add(nChars); nChars = 0; } else { nChars++; } } TextElementEnumerator te = StringInfo.GetTextElementEnumerator(opening); while (te.MoveNext()) { string s = te.GetTextElement(); // Skip the ' character. if (s == "\u0027") continue; if ( String.IsNullOrEmpty(s.Trim()) | (s.Length == 1 && Char.IsPunctuation(Convert.ToChar(s)))) { elements.Add(nChars); nChars = 0; } else { nChars++; } } // Display character counts. Console.WriteLine("{0,6} {1,20} {2,20}", "Word #", "Char Objects", "Characters"); for (int ctr = 0; ctr < chars.Count; ctr++) Console.WriteLine("{0,6} {1,20} {2,20}", ctr, chars[ctr], elements[ctr]); } } // The example displays the following output: // Word # Char Objects Characters // 0 2 2 // 1 4 4 // 2 3 3 // 3 4 4 // 4 3 3 // 5 8 8 // 6 8 7 // 7 3 3 // 8 2 2 // 9 8 8 // 10 2 1 // 11 8 8 // 12 3 3 // 13 3 3 // 14 9 9 // 15 15 15 // 16 2 2 // 17 6 6 // 18 12 12 </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/index3.vb" name="System.String.Class#6">Imports System.Collections.Generic Imports System.Globalization Module Example Public Sub Main() ' First sentence of The Mystery of the Yellow Room, by Leroux. Dim opening As String = "Ce n'est pas sans une certaine émotion que "+ "je commence à raconter ici les aventures " + "extraordinaires de Joseph Rouletabille." ' Character counters. Dim nChars As Integer = 0 ' Objects to store word count. Dim chars As New List(Of Integer)() Dim elements As New List(Of Integer)() For Each ch In opening ' Skip the ' character. If ch = ChrW(&h0027) Then Continue For If Char.IsWhiteSpace(ch) Or Char.IsPunctuation(ch) Then chars.Add(nChars) nChars = 0 Else nChars += 1 End If Next Dim te As TextElementEnumerator = StringInfo.GetTextElementEnumerator(opening) Do While te.MoveNext() Dim s As String = te.GetTextElement() ' Skip the ' character. If s = ChrW(&h0027) Then Continue Do If String.IsNullOrEmpty(s.Trim()) Or (s.Length = 1 AndAlso Char.IsPunctuation(Convert.ToChar(s))) elements.Add(nChars) nChars = 0 Else nChars += 1 End If Loop ' Display character counts. Console.WriteLine("{0,6} {1,20} {2,20}", "Word #", "Char Objects", "Characters") For ctr As Integer = 0 To chars.Count - 1 Console.WriteLine("{0,6} {1,20} {2,20}", ctr, chars(ctr), elements(ctr)) Next End Sub End Module ' The example displays the following output: ' Word # Char Objects Characters ' 0 2 2 ' 1 4 4 ' 2 3 3 ' 3 4 4 ' 4 3 3 ' 5 8 8 ' 6 8 7 ' 7 3 3 ' 8 2 2 ' 9 8 8 ' 10 2 1 ' 11 8 8 ' 12 3 3 ' 13 3 3 ' 14 9 9 ' 15 15 15 ' 16 2 2 ' 17 6 6 ' 18 12 12 </code></pre><p> This example works with text elements by using the <a class="xref" href="system.globalization.stringinfo.gettextelementenumerator?view=netframework-4.7" data-linktype="relative-path">System.Globalization.StringInfo.GetTextElementEnumerator</a> method and the <a class="xref" href="system.globalization.textelementenumerator?view=netframework-4.7" data-linktype="relative-path">TextElementEnumerator</a> class to enumerate all the text elements in a string. You can also retrieve an array that contains the starting index of each text element by calling the <a class="xref" href="system.globalization.stringinfo.parsecombiningcharacters?view=netframework-4.7" data-linktype="relative-path">System.Globalization.StringInfo.ParseCombiningCharacters</a> method. </p> <p> For more information about working with units of text rather than individual <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> values, see the <a class="xref" href="system.globalization.stringinfo?view=netframework-4.7" data-linktype="relative-path">StringInfo</a> class. </p> <p><a name="Nulls"></a> </p> <h3 class="accented" id="null-strings-and-empty-strings">Null strings and empty strings</h3> <p> A string that has been declared but has not been assigned a value is <code>null</code>. Attempting to call methods on that string throws a <a class="xref" href="system.nullreferenceexception?view=netframework-4.7" data-linktype="relative-path">NullReferenceException</a>. A null string is different from an empty string, which is a string whose value is "" or <a class="xref" href="system.string.empty?view=netframework-4.7" data-linktype="relative-path">System.String.Empty</a>. In some cases, passing either a null string or an empty string as an argument in a method call throws an exception. For example, passing a null string to the <a class="xref" href="system.int32.parse?view=netframework-4.7" data-linktype="relative-path">System.Int32.Parse</a> method throws an <a class="xref" href="system.argumentnullexception?view=netframework-4.7" data-linktype="relative-path">ArgumentNullException</a>, and passing an empty string throws a <a class="xref" href="system.formatexception?view=netframework-4.7" data-linktype="relative-path">FormatException</a>. In other cases, a method argument can be either a null string or an empty string. For example, if you are providing an <a class="xref" href="system.iformattable?view=netframework-4.7" data-linktype="relative-path">IFormattable</a> implementation for a class, you want to equate both a null string and an empty string with the general ("G") format specifier. </p> <p> The <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class includes the following two convenience methods that enable you to test whether a string is <code>null</code> or empty: </p> <ul> <li><p><a class="xref" href="system.string.isnullorempty?view=netframework-4.7" data-linktype="relative-path">IsNullOrEmpty</a>, which indicates whether a string is either <code>null</code> or is equal to <a class="xref" href="system.string.empty?view=netframework-4.7" data-linktype="relative-path">System.String.Empty</a>. This method eliminates the need to use code such as the following: </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.class.null/cpp/string.null.cpp" name="System.String.Class.Null#1">if (str == nullptr || str->Equals(String::Empty)) </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.class.null/cs/nullorempty1.cs" name="System.String.Class.Null#1">if (str == null || str.Equals(String.Empty)) </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.class.null/vb/nullorempty1.vb" name="System.String.Class.Null#1">If str Is Nothing OrElse str.Equals(String.Empty) Then </code></pre></li> <li><p><a class="xref" href="system.string.isnullorwhitespace?view=netframework-4.7" data-linktype="relative-path">IsNullOrWhiteSpace</a>, which indicates whether a string is <code>null</code>, equals <a class="xref" href="system.string.empty?view=netframework-4.7" data-linktype="relative-path">System.String.Empty</a>, or consists exclusively of white-space characters. This method eliminates the need to use code such as the following: </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.class.null/cpp/string.null.cpp" name="System.String.Class.Null#2">if (str == nullptr || str->Equals(String::Empty) || str->Trim()->Equals(String::Empty)) </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.class.null/cs/nullorempty1.cs" name="System.String.Class.Null#2">if (str == null || str.Equals(String.Empty) || str.Trim().Equals(String.Empty)) </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.class.null/vb/nullorempty1.vb" name="System.String.Class.Null#2">If str Is Nothing OrElse str.Equals(String.Empty) OrElse str.Trim().Equals(String.Empty) </code></pre></li> </ul> <p> The following example uses the <a class="xref" href="system.string.isnullorempty?view=netframework-4.7" data-linktype="relative-path">IsNullOrEmpty</a> method in the <a class="xref" href="system.iformattable.tostring?view=netframework-4.7" data-linktype="relative-path">System.IFormattable.ToString</a> implementation of a custom <code>Temperature</code> class. The method supports the "G", "C", "F", and "K" format strings. If an empty format string or a format string whose value is <code>null</code> is passed to the method, its value is changed to the "G" format string. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.class.null/cpp/string.null.cpp" name="System.String.Class.Null#3">public: virtual String^ ToString(String^ format, IFormatProvider^ provider) { if (String::IsNullOrEmpty(format)) format = "G"; if (provider == nullptr) provider = CultureInfo::CurrentCulture; switch (Convert::ToUInt16(format->ToUpperInvariant())) { // Return degrees in Celsius. case 'G': case 'C': return temp.ToString("F2", provider) + L"�C"; // Return degrees in Fahrenheit. case 'F': return (temp * 9 / 5 + 32).ToString("F2", provider) + L"�F"; // Return degrees in Kelvin. case 'K': return (temp + 273.15).ToString(); default: throw gcnew FormatException( String::Format("The {0} format string is not supported.", format)); } } </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.class.null/cs/nullorempty1.cs" name="System.String.Class.Null#3">public string ToString(string format, IFormatProvider provider) { if (String.IsNullOrEmpty(format)) format = "G"; if (provider == null) provider = CultureInfo.CurrentCulture; switch (format.ToUpperInvariant()) { // Return degrees in Celsius. case "G": case "C": return temp.ToString("F2", provider) + "°C"; // Return degrees in Fahrenheit. case "F": return (temp * 9 / 5 + 32).ToString("F2", provider) + "°F"; // Return degrees in Kelvin. case "K": return (temp + 273.15).ToString(); default: throw new FormatException( String.Format("The {0} format string is not supported.", format)); } } </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.class.null/vb/nullorempty1.vb" name="System.String.Class.Null#3">Public Overloads Function ToString(fmt As String, provider As IFormatProvider) As String _ Implements IFormattable.ToString If String.IsNullOrEmpty(fmt) Then fmt = "G" If provider Is Nothing Then provider = CultureInfo.CurrentCulture Select Case fmt.ToUpperInvariant() ' Return degrees in Celsius. Case "G", "C" Return temp.ToString("F2", provider) + "°C" ' Return degrees in Fahrenheit. Case "F" Return (temp * 9 / 5 + 32).ToString("F2", provider) + "°F" ' Return degrees in Kelvin. Case "K" Return (temp + 273.15).ToString() Case Else Throw New FormatException( String.Format("The {0} format string is not supported.", fmt)) End Select End Function </code></pre><p><a name="Immutability"></a> </p> <h3 class="accented" id="immutability-and-the-stringbuilder-class">Immutability and the StringBuilder class</h3> <p> A <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object is called immutable (read-only), because its value cannot be modified after it has been created. Methods that appear to modify a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object actually return a new <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object that contains the modification. </p> <p> Because strings are immutable, string manipulation routines that perform repeated additions or deletions to what appears to be a single string can exact a significant performance penalty. For example, the following code uses a random number generator to create a string with 1000 characters in the range 0x0001 to 0x052F. Although the code appears to use string concatenation to append a new character to the existing string named <code>str</code>, it actually creates a new <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object for each concatenation operation. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.stringbuilder1.cpp" name="System.String.Class#15">using namespace System; using namespace System::IO; using namespace System::Text; void main() { Random^ rnd = gcnew Random(); String^ str = String::Empty; StreamWriter^ sw = gcnew StreamWriter(".\\StringFile.txt", false, Encoding::Unicode); for (int ctr = 0; ctr <= 1000; ctr++) { str += Convert::ToChar(rnd->Next(1, 0x0530)); if (str->Length % 60 == 0) str += Environment::NewLine; } sw->Write(str); sw->Close(); } </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/immutable.cs" name="System.String.Class#15">using System; using System.IO; using System.Text; public class Example { public static void Main() { Random rnd = new Random(); string str = String.Empty; StreamWriter sw = new StreamWriter(@".\StringFile.txt", false, Encoding.Unicode); for (int ctr = 0; ctr <= 1000; ctr++) { str += Convert.ToChar(rnd.Next(1, 0x0530)); if (str.Length % 60 == 0) str += Environment.NewLine; } sw.Write(str); sw.Close(); } } </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/immutable.vb" name="System.String.Class#15">Imports System.IO Imports System.Text Module Example Public Sub Main() Dim rnd As New Random() Dim str As String = String.Empty Dim sw As New StreamWriter(".\StringFile.txt", False, Encoding.Unicode) For ctr As Integer = 0 To 1000 str += ChrW(rnd.Next(1, &h0530)) If str.Length Mod 60 = 0 Then str += vbCrLf Next sw.Write(str) sw.Close() End Sub End Module </code></pre><p> You can use the <a class="xref" href="system.text.stringbuilder?view=netframework-4.7" data-linktype="relative-path">StringBuilder</a> class instead of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class for operations that make multiple changes to the value of a string. Unlike instances of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class, <a class="xref" href="system.text.stringbuilder?view=netframework-4.7" data-linktype="relative-path">StringBuilder</a> objects are mutable; when you concatenate, append, or delete substrings from a string, the operations are performed on a single string. When you have finished modifying the value of a <a class="xref" href="system.text.stringbuilder?view=netframework-4.7" data-linktype="relative-path">StringBuilder</a> object, you can call its <a class="xref" href="system.text.stringbuilder.tostring?view=netframework-4.7" data-linktype="relative-path">System.Text.StringBuilder.ToString</a> method to convert it to a string. The following example replaces the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> used in the previous example to concatenate 1000 random characters in the range to 0x0001 to 0x052F with a <a class="xref" href="system.text.stringbuilder?view=netframework-4.7" data-linktype="relative-path">StringBuilder</a> object. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.stringbuilder2.cpp" name="System.String.Class#16">using namespace System; using namespace System::IO; using namespace System::Text; void main() { Random^ rnd = gcnew Random(); StringBuilder^ sb = gcnew StringBuilder(); StreamWriter^ sw = gcnew StreamWriter(".\\StringFile.txt", false, Encoding::Unicode); for (int ctr = 0; ctr <= 1000; ctr++) { sb->Append(Convert::ToChar(rnd->Next(1, 0x0530))); if (sb->Length % 60 == 0) sb->AppendLine(); } sw->Write(sb->ToString()); sw->Close(); } </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/immutable1.cs" name="System.String.Class#16">using System; using System.IO; using System.Text; public class Example { public static void Main() { Random rnd = new Random(); StringBuilder sb = new StringBuilder(); StreamWriter sw = new StreamWriter(@".\StringFile.txt", false, Encoding.Unicode); for (int ctr = 0; ctr <= 1000; ctr++) { sb.Append(Convert.ToChar(rnd.Next(1, 0x0530))); if (sb.Length % 60 == 0) sb.AppendLine(); } sw.Write(sb.ToString()); sw.Close(); } } </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/immutable1.vb" name="System.String.Class#16">Imports System.IO Imports System.Text Module Example Public Sub Main() Dim rnd As New Random() Dim sb As New StringBuilder() Dim sw As New StreamWriter(".\StringFile.txt", False, Encoding.Unicode) For ctr As Integer = 0 To 1000 sb.Append(ChrW(rnd.Next(1, &h0530))) If sb.Length Mod 60 = 0 Then sb.AppendLine() Next sw.Write(sb.ToString()) sw.Close() End Sub End Module </code></pre><p><a name="CultureSensitive"></a> </p> <h3 class="accented" id="ordinal-vs-culture-sensitive-operations">Ordinal vs. culture-sensitive operations</h3> <p> Members of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class perform either ordinal or culture-sensitive (linguistic) operations on a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object. An ordinal operation acts on the numeric value of each <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object. A culture-sensitive operation acts on the value of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object, and takes culture-specific casing, sorting, formatting, and parsing rules into account. Culture-sensitive operations execute in the context of an explicitly declared culture or the implicit current culture. The two kinds of operations can produce very different results when they are performed on the same string. </p> <p> The .NET Framework also supports culture-insensitive linguistic string operations by using the invariant culture (<a class="xref" href="system.globalization.cultureinfo.invariantculture?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CultureInfo.InvariantCulture</a>), which is loosely based on the culture settings of the English language independent of region. Unlike other <a class="xref" href="system.globalization.cultureinfo?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CultureInfo</a> settings, the settings of the invariant culture are guaranteed to remain consistent on a single computer, from system to system, and across versions of the .NET Framework. The invariant culture can be seen as a kind of black box that ensures stability of string comparisons and ordering across all cultures. </p> <div class="IMPORTANT"><h5>Important</h5><p> If your application makes a security decision about a symbolic identifier such as a file name or named pipe, or about persisted data such as the text-based data in an XML file, the operation should use an ordinal comparison instead of a culture-sensitive comparison. This is because a culture-sensitive comparison can yield different results depending on the culture in effect, whereas an ordinal comparison depends solely on the binary value of the compared characters. </p> </div> <div class="IMPORTANT"><h5>Important</h5><p> Most methods that perform string operations include an overload that has a parameter of type <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">StringComparison</a>, which enables you to specify whether the method performs an ordinal or culture-sensitive operation. In general, you should call this overload to make the intent of your method call clear. For best practices and guidance for using ordinal and culture-sensitive operations on strings, see <a href="../standard/base-types/best-practices-strings?view=netframework-4.7" data-linktype="relative-path">Best Practices for Using Strings</a>. </p> </div> <p> Operations for <a href="#casing" data-linktype="self-bookmark">casing</a>, <a href="#parsing" data-linktype="self-bookmark">parsing and formatting</a>, <a href="#comparison" data-linktype="self-bookmark">comparison and sorting</a>, and <a href="#equality" data-linktype="self-bookmark">testing for equality</a> can be either ordinal or culture-sensitive. The following sections discuss each category of operation. </p> <div class="TIP"><h5>Tip</h5><p> You should always call a method overload that makes the intent of your method call clear. For example, instead of calling the <a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_" data-linktype="relative-path">Compare(String, String)</a> method to perform a culture-sensitive comparison of two strings by using the conventions of the current culture, you should call the <a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_System_StringComparison_" data-linktype="relative-path">Compare(String, String, StringComparison)</a> method with a value of <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">System.StringComparison</a> for the <code>comparisonType</code> argument. For more information, see <a href="../standard/base-types/best-practices-strings?view=netframework-4.7" data-linktype="relative-path">Best Practices for Using Strings</a>. </p> </div> <p><a name="casing"></a> </p> <h4 class="accented" id="casing">Casing</h4> <p> Casing rules determine how to change the capitalization of a Unicode character; for example, from lowercase to uppercase. Often, a casing operation is performed before a string comparison. For example, a string might be converted to uppercase so that it can be compared with another uppercase string. You can convert the characters in a string to lowercase by calling the <a class="xref" href="system.string.tolower?view=netframework-4.7" data-linktype="relative-path">ToLower</a> or <a class="xref" href="system.string.tolowerinvariant?view=netframework-4.7" data-linktype="relative-path">ToLowerInvariant</a> method, and you can convert them to uppercase by calling the <a class="xref" href="system.string.toupper?view=netframework-4.7" data-linktype="relative-path">ToUpper</a> or <a class="xref" href="system.string.toupperinvariant?view=netframework-4.7" data-linktype="relative-path">ToUpperInvariant</a> method. In addition, you can use the <a class="xref" href="system.globalization.textinfo.totitlecase?view=netframework-4.7" data-linktype="relative-path">System.Globalization.TextInfo.ToTitleCase</a> method to convert a string to title case. </p> <p> Casing operations can be based on the rules of the current culture, a specified culture, or the invariant culture. Because case mappings can vary depending on the culture used, the result of casing operations can vary based on culture. The actual differences in casing are of three kinds: </p> <ul> <li><p>Differences in the case mapping of LATIN CAPITAL LETTER I (U+0049), LATIN SMALL LETTER I (U+0069), LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130), and LATIN SMALL LETTER DOTLESS I (U+0131). In the tr-TR (Turkish (Turkey)) and az-Latn-AZ (Azerbaijan, Latin) cultures, and in the tr, az, and az-Latn neutral cultures, the lowercase equivalent of LATIN CAPITAL LETTER I is LATIN SMALL LETTER DOTLESS I, and the uppercase equivalent of LATIN SMALL LETTER I is LATIN CAPITAL LETTER I WITH DOT ABOVE. In all other cultures, including the invariant culture, LATIN SMALL LETTER I and LATIN CAPITAL LETTER I are lowercase and uppercase equivalents. </p> <p> The following example demonstrates how a string comparison designed to prevent file system access can fail if it relies on a culture-sensitive casing comparison. (The casing conventions of the invariant culture should have been used.) </p> <pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/case2.cs" name="System.String.Class#17">using System; using System.Globalization; using System.Threading; public class Example { const string disallowed = "file"; public static void Main() { IsAccessAllowed(@"FILE:\\\c:\users\user001\documents\FinancialInfo.txt"); } private static void IsAccessAllowed(String resource) { CultureInfo[] cultures = { CultureInfo.CreateSpecificCulture("en-US"), CultureInfo.CreateSpecificCulture("tr-TR") }; String scheme = null; int index = resource.IndexOfAny( new Char[] { '\\', '/' } ); if (index > 0) scheme = resource.Substring(0, index - 1); // Change the current culture and perform the comparison. foreach (var culture in cultures) { Thread.CurrentThread.CurrentCulture = culture; Console.WriteLine("Culture: {0}", CultureInfo.CurrentCulture.DisplayName); Console.WriteLine(resource); Console.WriteLine("Access allowed: {0}", ! String.Equals(disallowed, scheme, StringComparison.CurrentCultureIgnoreCase)); Console.WriteLine(); } } } // The example displays the following output: // Culture: English (United States) // FILE:\\\c:\users\user001\documents\FinancialInfo.txt // Access allowed: False // // Culture: Turkish (Turkey) // FILE:\\\c:\users\user001\documents\FinancialInfo.txt // Access allowed: True </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/case2.vb" name="System.String.Class#17">Imports System.Globalization Imports System.Threading Module Example Const disallowed = "file" Public Sub Main() IsAccessAllowed("FILE:\\\c:\users\user001\documents\FinancialInfo.txt") End Sub Private Sub IsAccessAllowed(resource As String) Dim cultures() As CultureInfo = { CultureInfo.CreateSpecificCulture("en-US"), CultureInfo.CreateSpecificCulture("tr-TR") } Dim scheme As String = Nothing Dim index As Integer = resource.IndexOfAny( {"\"c, "/"c }) If index > 0 Then scheme = resource.Substring(0, index - 1) ' Change the current culture and perform the comparison. For Each culture In cultures Thread.CurrentThread.CurrentCulture = culture Console.WriteLine("Culture: {0}", CultureInfo.CurrentCulture.DisplayName) Console.WriteLine(resource) Console.WriteLine("Access allowed: {0}", Not String.Equals(disallowed, scheme, StringComparison.CurrentCultureIgnoreCase)) Console.WriteLine() Next End Sub End Module ' The example displays the following output: ' Culture: English (United States) ' FILE:\\\c:\users\user001\documents\FinancialInfo.txt ' Access allowed: False ' ' Culture: Turkish (Turkey) ' FILE:\\\c:\users\user001\documents\FinancialInfo.txt ' Access allowed: True </code></pre></li> <li><p>Differences in case mappings between the invariant culture and all other cultures. In these cases, using the casing rules of the invariant culture to change a character to uppercase or lowercase returns the same character. For all other cultures, it returns a different character. Some of the affected characters are listed in the following table. </p> <table> <thead> <tr> <th>Character</th> <th>If changed to</th> <th>Returns</th> </tr> </thead> <tbody> <tr> <td>MICRON SIGN (U+00B5)</td> <td>Uppercase</td> <td>GREEK CAPITAL LETTER MU (U+-39C)</td> </tr> <tr> <td>LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130)</td> <td>Lowercase</td> <td>LATIN SMALL LETTER I (U+0069)</td> </tr> <tr> <td>LATIN SMALL LETTER DOTLESS I (U+0131)</td> <td>Uppercase</td> <td>LATIN CAPITAL LETTER I (U+0049)</td> </tr> <tr> <td>LATIN SMALL LETTER LONG S (U+017F)</td> <td>Uppercase</td> <td>LATIN CAPITAL LETTER S (U+0053)</td> </tr> <tr> <td>LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON (U+01C5)</td> <td>Lowercase</td> <td>LATIN SMALL LETTER DZ WITH CARON (U+01C6)</td> </tr> <tr> <td>COMBINING GREEK YPOGEGRAMMENI (U+0345)</td> <td>Uppercase</td> <td>GREEK CAPITAL LETTER IOTA (U+0399)</td> </tr> </tbody> </table> </li> <li><p>Differences in case mappings of two-letter mixed-case pairs in the ASCII character range. In most cultures, a two-letter mixed-case pair is equal to the equivalent two-letter uppercase or lowercase pair. This is not true for the following two-letter pairs in the following cultures, because in each case they are compared to a digraph: </p> <ul> <li><p>"lJ" and "nJ" in the hr-HR (Croatian (Croatia)) culture. </p> </li> <li><p>"cH" in the cs-CZ (Czech (Czech Republic)) and sk-SK (Slovak (Slovakia)) cultures. </p> </li> <li><p>"aA" in the da-DK (Danish (Denmark)) culture. </p> </li> <li><p>"cS", "dZ", "dZS", "nY", "sZ", "tY", and "zS" in the hu-HU (Hungarian (Hungary)) culture. </p> </li> <li><p>"cH" and "lL" in the es-ES_tradnl (Spanish (Spain, Traditional Sort)) culture. </p> </li> <li><p>"cH", "gI", "kH", "nG" "nH", "pH", "qU', "tH", and "tR" in the vi-VN (Vietnamese (Vietnam)) culture. </p> </li> </ul> <p> However, it is unusual to encounter a situation in which a culture-sensitive comparison of these pairs creates problems, because these pairs are uncommon in fixed strings or identifiers. </p> </li> </ul> <p> The following example illustrates some of the differences in casing rules between cultures when converting strings to uppercase. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.casing.cpp" name="System.String.Class#7">using namespace System; using namespace System::Globalization; using namespace System::IO; String^ ShowHexValue(String^ s); void main() { StreamWriter^ sw = gcnew StreamWriter(".\\case.txt"); array<String^>^ words = gcnew array<String^> { L"file", L"sıfır", L"Dženana" }; array<CultureInfo^>^ cultures = gcnew array<CultureInfo^> { CultureInfo::InvariantCulture, gcnew CultureInfo("en-US"), gcnew CultureInfo("tr-TR") }; for each (String^ word in words) { sw->WriteLine("{0}:", word); for each (CultureInfo^ culture in cultures) { String^ name = String::IsNullOrEmpty(culture->Name) ? "Invariant" : culture->Name; String^ upperWord = word->ToUpper(culture); sw->WriteLine(" {0,10}: {1,7} {2, 38}", name, upperWord, ShowHexValue(upperWord)); } sw->WriteLine(); } sw->Close(); } String^ ShowHexValue(String^ s) { String^ retval = nullptr; for each (Char ch in s) { array<Byte>^ bytes = BitConverter::GetBytes(ch); retval += String::Format("{0:X2} {1:X2} ", bytes[1], bytes[0]); } return retval; } // The example displays the following output: // file: // Invariant: FILE 00 46 00 49 00 4C 00 45 // en-US: FILE 00 46 00 49 00 4C 00 45 // tr-TR: FİLE 00 46 01 30 00 4C 00 45 // // sıfır: // Invariant: SıFıR 00 53 01 31 00 46 01 31 00 52 // en-US: SIFIR 00 53 00 49 00 46 00 49 00 52 // tr-TR: SIFIR 00 53 00 49 00 46 00 49 00 52 // // Dženana: // Invariant: DžENANA 01 C5 00 45 00 4E 00 41 00 4E 00 41 // en-US: DŽENANA 01 C4 00 45 00 4E 00 41 00 4E 00 41 // tr-TR: DŽENANA 01 C4 00 45 00 4E 00 41 00 4E 00 41 </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/case1.cs" name="System.String.Class#7">using System; using System.Globalization; using System.IO; public class Example { public static void Main() { StreamWriter sw = new StreamWriter(@".\case.txt"); string[] words = { "file", "sıfır", "Dženana" }; CultureInfo[] cultures = { CultureInfo.InvariantCulture, new CultureInfo("en-US"), new CultureInfo("tr-TR") }; foreach (var word in words) { sw.WriteLine("{0}:", word); foreach (var culture in cultures) { string name = String.IsNullOrEmpty(culture.Name) ? "Invariant" : culture.Name; string upperWord = word.ToUpper(culture); sw.WriteLine(" {0,10}: {1,7} {2, 38}", name, upperWord, ShowHexValue(upperWord)); } sw.WriteLine(); } sw.Close(); } private static string ShowHexValue(string s) { string retval = null; foreach (var ch in s) { byte[] bytes = BitConverter.GetBytes(ch); retval += String.Format("{0:X2} {1:X2} ", bytes[1], bytes[0]); } return retval; } } // The example displays the following output: // file: // Invariant: FILE 00 46 00 49 00 4C 00 45 // en-US: FILE 00 46 00 49 00 4C 00 45 // tr-TR: FİLE 00 46 01 30 00 4C 00 45 // // sıfır: // Invariant: SıFıR 00 53 01 31 00 46 01 31 00 52 // en-US: SIFIR 00 53 00 49 00 46 00 49 00 52 // tr-TR: SIFIR 00 53 00 49 00 46 00 49 00 52 // // Dženana: // Invariant: DžENANA 01 C5 00 45 00 4E 00 41 00 4E 00 41 // en-US: DŽENANA 01 C4 00 45 00 4E 00 41 00 4E 00 41 // tr-TR: DŽENANA 01 C4 00 45 00 4E 00 41 00 4E 00 41 </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/case1.vb" name="System.String.Class#7">Imports System.Globalization Imports System.IO Module Example Public Sub Main() Dim sw As New StreamWriter(".\case.txt") Dim words As String() = { "file", "sıfır", "Dženana" } Dim cultures() As CultureInfo = { CultureInfo.InvariantCulture, New CultureInfo("en-US"), New CultureInfo("tr-TR") } For Each word In words sw.WriteLine("{0}:", word) For Each culture In cultures Dim name As String = If(String.IsNullOrEmpty(culture.Name), "Invariant", culture.Name) Dim upperWord As String = word.ToUpper(culture) sw.WriteLine(" {0,10}: {1,7} {2, 38}", name, upperWord, ShowHexValue(upperWord)) Next sw.WriteLine() Next sw.Close() End Sub Private Function ShowHexValue(s As String) As String Dim retval As String = Nothing For Each ch In s Dim bytes() As Byte = BitConverter.GetBytes(ch) retval += String.Format("{0:X2} {1:X2} ", bytes(1), bytes(0)) Next Return retval End Function End Module ' The example displays the following output: ' file: ' Invariant: FILE 00 46 00 49 00 4C 00 45 ' en-US: FILE 00 46 00 49 00 4C 00 45 ' tr-TR: FİLE 00 46 01 30 00 4C 00 45 ' ' sıfır: ' Invariant: SıFıR 00 53 01 31 00 46 01 31 00 52 ' en-US: SIFIR 00 53 00 49 00 46 00 49 00 52 ' tr-TR: SIFIR 00 53 00 49 00 46 00 49 00 52 ' ' Dženana: ' Invariant: DžENANA 01 C5 00 45 00 4E 00 41 00 4E 00 41 ' en-US: DŽENANA 01 C4 00 45 00 4E 00 41 00 4E 00 41 ' tr-TR: DŽENANA 01 C4 00 45 00 4E 00 41 00 4E 00 41 </code></pre><p><a name="parsing"></a> </p> <h4 class="accented" id="parsing-and-formatting">Parsing and formatting</h4> <p> Formatting and parsing are inverse operations. Formatting rules determine how to convert a value, such as a date and time or a number, to its string representation, whereas parsing rules determine how to convert a string representation to a value such as a date and time. Both formatting and parsing rules are dependent on cultural conventions. The following example illustrates the ambiguity that can arise when interpreting a culture-specific date string. Without knowing the conventions of the culture that was used to produce a date string, it is not possible to know whether 03/01/2011, 3/1/2011, and 01/03/2011 represent January 3, 2011 or March 1, 2011. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.format1.cpp" name="System.String.Class#8">using namespace System; using namespace System::Globalization; void main() { DateTime^ date = gcnew DateTime(2011, 3, 1); array<CultureInfo^>^ cultures = gcnew array<CultureInfo^> { CultureInfo::InvariantCulture, gcnew CultureInfo("en-US"), gcnew CultureInfo("fr-FR") }; for each (CultureInfo^ culture in cultures) Console::WriteLine("{0,-12} {1}", String::IsNullOrEmpty(culture->Name) ? "Invariant" : culture->Name, date->ToString("d", culture)); } // The example displays the following output: // Invariant 03/01/2011 // en-US 3/1/2011 // fr-FR 01/03/2011 </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/format1.cs" name="System.String.Class#8">using System; using System.Globalization; public class Example { public static void Main() { DateTime date = new DateTime(2011, 3, 1); CultureInfo[] cultures = { CultureInfo.InvariantCulture, new CultureInfo("en-US"), new CultureInfo("fr-FR") }; foreach (var culture in cultures) Console.WriteLine("{0,-12} {1}", String.IsNullOrEmpty(culture.Name) ? "Invariant" : culture.Name, date.ToString("d", culture)); } } // The example displays the following output: // Invariant 03/01/2011 // en-US 3/1/2011 // fr-FR 01/03/2011 </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/format1.vb" name="System.String.Class#8">Imports System.Globalization Module Example Public Sub Main() Dim dat As Date = #3/1/2011# Dim cultures() As CultureInfo = { CultureInfo.InvariantCulture, New CultureInfo("en-US"), New CultureInfo("fr-FR") } For Each culture In cultures Console.WriteLine("{0,-12} {1}", If(String.IsNullOrEmpty(culture.Name), "Invariant", culture.Name), dat.ToString("d", culture)) Next End Sub End Module ' The example displays the following output: ' Invariant 03/01/2011 ' en-US 3/1/2011 ' fr-FR 01/03/2011 </code></pre><p> Similarly, as the following example shows, a single string can produce different dates depending on the culture whose conventions are used in the parsing operation. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.parse1.cpp" name="System.String.Class#9">using namespace System; using namespace System::Globalization; void main() { String^ dateString = "07/10/2011"; array<CultureInfo^>^ cultures = gcnew array<CultureInfo^> { CultureInfo::InvariantCulture, CultureInfo::CreateSpecificCulture("en-GB"), CultureInfo::CreateSpecificCulture("en-US") }; Console::WriteLine("{0,-12} {1,10} {2,8} {3,8}\n", "Date String", "Culture", "Month", "Day"); for each (CultureInfo^ culture in cultures) { DateTime date = DateTime::Parse(dateString, culture); Console::WriteLine("{0,-12} {1,10} {2,8} {3,8}", dateString, String::IsNullOrEmpty(culture->Name) ? "Invariant" : culture->Name, date.Month, date.Day); } } // The example displays the following output: // Date String Culture Month Day // // 07/10/2011 Invariant 7 10 // 07/10/2011 en-GB 10 7 // 07/10/2011 en-US 7 10 </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/parse1.cs" name="System.String.Class#9">using System; using System.Globalization; public class Example { public static void Main() { string dateString = "07/10/2011"; CultureInfo[] cultures = { CultureInfo.InvariantCulture, CultureInfo.CreateSpecificCulture("en-GB"), CultureInfo.CreateSpecificCulture("en-US") }; Console.WriteLine("{0,-12} {1,10} {2,8} {3,8}\n", "Date String", "Culture", "Month", "Day"); foreach (var culture in cultures) { DateTime date = DateTime.Parse(dateString, culture); Console.WriteLine("{0,-12} {1,10} {2,8} {3,8}", dateString, String.IsNullOrEmpty(culture.Name) ? "Invariant" : culture.Name, date.Month, date.Day); } } } // The example displays the following output: // Date String Culture Month Day // // 07/10/2011 Invariant 7 10 // 07/10/2011 en-GB 10 7 // 07/10/2011 en-US 7 10 </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/parse1.vb" name="System.String.Class#9">Imports System.Globalization Module Example Public Sub Main() Dim dateString As String = "07/10/2011" Dim cultures() As CultureInfo = { CultureInfo.InvariantCulture, CultureInfo.CreateSpecificCulture("en-GB"), CultureInfo.CreateSpecificCulture("en-US") } Console.WriteLine("{0,-12} {1,10} {2,8} {3,8}", "Date String", "Culture", "Month", "Day") Console.WriteLine() For Each culture In cultures Dim dat As Date = DateTime.Parse(dateString, culture) Console.WriteLine("{0,-12} {1,10} {2,8} {3,8}", dateString, If(String.IsNullOrEmpty(culture.Name), "Invariant", culture.Name), dat.Month, dat.Day) Next End Sub End Module ' The example displays the following output: ' Date String Culture Month Day ' ' 07/10/2011 Invariant 7 10 ' 07/10/2011 en-GB 10 7 ' 07/10/2011 en-US 7 10 </code></pre><p><a name="comparison"></a> </p> <h4 class="accented" id="string-comparison-and-sorting">String comparison and sorting</h4> <p> Conventions for comparing and sorting strings vary from culture to culture. For example, the sort order may be based on phonetics or on the visual representation of characters. In East Asian languages, characters are sorted by the stroke and radical of ideographs. Sorting also depends on the order languages and cultures use for the alphabet. For example, the Danish language has an "Æ" character that it sorts after "Z" in the alphabet. In addition, comparisons can be case-sensitive or case-insensitive, and in some cases casing rules also differ by culture. Ordinal comparison, on the other hand, uses the Unicode code points of individual characters in a string when comparing and sorting strings. </p> <p> Sort rules determine the alphabetic order of Unicode characters and how two strings compare to each other. For example, the <a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_System_StringComparison_" data-linktype="relative-path">System.String.Compare(String, String, StringComparison)</a> method compares two strings based on the <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">StringComparison</a> parameter. If the parameter value is <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">System.StringComparison</a>, the method performs a linguistic comparison that uses the conventions of the current culture; if the parameter value is <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">System.StringComparison</a>, the method performs an ordinal comparison. Consequently, as the following example shows, if the current culture is U.S. English, the first call to the <a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_System_StringComparison_" data-linktype="relative-path">System.String.Compare(String, String, StringComparison)</a> method (using culture-sensitive comparison) considers "a" less than "A", but the second call to the same method (using ordinal comparison) considers "a" greater than "A". </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.compare1.cpp" name="System.String.Class#10">using namespace System; using namespace System::Globalization; using namespace System::Threading; void main() { Thread::CurrentThread->CurrentCulture = CultureInfo::CreateSpecificCulture("en-US"); Console::WriteLine(String::Compare("A", "a", StringComparison::CurrentCulture)); Console::WriteLine(String::Compare("A", "a", StringComparison::Ordinal)); } // The example displays the following output: // 1 // -32 </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/compare1.cs" name="System.String.Class#10">using System; using System.Globalization; using System.Threading; public class Example { public static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); Console.WriteLine(String.Compare("A", "a", StringComparison.CurrentCulture)); Console.WriteLine(String.Compare("A", "a", StringComparison.Ordinal)); } } // The example displays the following output: // 1 // -32 </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/compare1.vb" name="System.String.Class#10">Imports System.Globalization Imports System.Threading Module Example Public Sub Main() Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US") Console.WriteLine(String.Compare("A", "a", StringComparison.CurrentCulture)) Console.WriteLine(String.Compare("A", "a", StringComparison.Ordinal)) End Sub End Module ' The example displays the following output: ' 1 ' -32 </code></pre><p> The .NET Framework supports word, string, and ordinal sort rules: </p> <ul> <li><p>A word sort performs a culture-sensitive comparison of strings in which certain nonalphanumeric Unicode characters might have special weights assigned to them. For example, the hyphen (-) might have a very small weight assigned to it so that "coop" and "co-op" appear next to each other in a sorted list. For a list of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> methods that compare two strings using word sort rules, see the <a href="#ByCategory" data-linktype="self-bookmark">String operations by category</a> section. </p> </li> <li><p>A string sort also performs a culture-sensitive comparison. It is similar to a word sort, except that there are no special cases, and all nonalphanumeric symbols come before all alphanumeric Unicode characters. Two strings can be compared using string sort rules by calling the <a class="xref" href="system.globalization.compareinfo.compare?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CompareInfo.Compare</a> method overloads that have an <code>options</code> parameter that is supplied a value of <a class="xref" href="system.globalization.compareoptions?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CompareOptions</a>. Note that this is the only method that the .NET Framework provides to compare two strings using string sort rules. </p> </li> <li><p>An ordinal sort compares strings based on the numeric value of each <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object in the string. An ordinal comparison is automatically case-sensitive because the lowercase and uppercase versions of a character have different code points. However, if case is not important, you can specify an ordinal comparison that ignores case. This is equivalent to converting the string to uppercase by using the invariant culture and then performing an ordinal comparison on the result. For a list of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> methods that compare two strings using ordinal sort rules, see the <a href="#ByCategory" data-linktype="self-bookmark">String operations by category</a> section. </p> </li> </ul> <p> A culture-sensitive comparison is any comparison that explicitly or implicitly uses a <a class="xref" href="system.globalization.cultureinfo?view=netframework-4.7" data-linktype="relative-path">CultureInfo</a> object, including the invariant culture that is specified by the <a class="xref" href="system.globalization.cultureinfo.invariantculture?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CultureInfo.InvariantCulture</a> property. The implicit culture is the current culture, which is specified by the <a class="xref" href="system.threading.thread.currentculture?view=netframework-4.7" data-linktype="relative-path">System.Threading.Thread.CurrentCulture</a> and <a class="xref" href="system.globalization.cultureinfo.currentculture?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CultureInfo.CurrentCulture</a> properties. There is considerable variation in the sort order of alphabetic characters (that is, characters for which the <a class="xref" href="system.char.isletter?view=netframework-4.7" data-linktype="relative-path">System.Char.IsLetter</a> property returns <code>true</code>) across cultures. You can specify a culture-sensitive comparison that uses the conventions of a specific culture by supplying a <a class="xref" href="system.globalization.cultureinfo?view=netframework-4.7" data-linktype="relative-path">CultureInfo</a> object to a string comparison method such as <a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_System_Globalization_CultureInfo_System_Globalization_CompareOptions_" data-linktype="relative-path">Compare(String, String, CultureInfo, CompareOptions)</a>. You can specify a culture-sensitive comparison that uses the conventions of the current culture by supplying <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">System.StringComparison</a>, <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">System.StringComparison</a>, or any member of the <a class="xref" href="system.globalization.compareoptions?view=netframework-4.7" data-linktype="relative-path">CompareOptions</a> enumeration other than <a class="xref" href="system.globalization.compareoptions?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CompareOptions</a> or <a class="xref" href="system.globalization.compareoptions?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CompareOptions</a> to an appropriate overload of the <a class="xref" href="system.string.compare?view=netframework-4.7" data-linktype="relative-path">Compare</a> method. A culture-sensitive comparison is generally appropriate for sorting whereas an ordinal comparison is not. An ordinal comparison is generally appropriate for determining whether two strings are equal (that is, for determining identity) whereas a culture-sensitive comparison is not. </p> <p> The following example illustrates the difference between culture-sensitive and ordinal comparison. The example evaluates three strings, "Apple", "Æble", and "AEble", using ordinal comparison and the conventions of the da-DK and en-US cultures (each of which is the default culture at the time the <a class="xref" href="system.string.compare?view=netframework-4.7" data-linktype="relative-path">Compare</a> method is called). Because the Danish language treats the character "Æ" as an individual letter and sorts it after "Z" in the alphabet, the string "Æble" is greater than "Apple". However, "Æble" is not considered equivalent to "AEble", so "Æble" is also greater than "AEble". The en-US culture doesn't include the letter"Æ" but treats it as equivalent to "AE", which explains why "Æble" is less than "Apple" but equal to "AEble". Ordinal comparison, on the other hand, considers "Apple" to be less than "Æble", and "Æble" to be greater than "AEble". </p> <pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/compare4.cs" name="System.String.Class#21">using System; using System.Globalization; using System.Threading; public class CompareStringSample { public static void Main() { string str1 = "Apple"; string str2 = "Æble"; string str3 = "AEble"; // Set the current culture to Danish in Denmark. Thread.CurrentThread.CurrentCulture = new CultureInfo("da-DK"); Console.WriteLine("Current culture: {0}", CultureInfo.CurrentCulture.Name); Console.WriteLine("Comparison of {0} with {1}: {2}", str1, str2, String.Compare(str1, str2)); Console.WriteLine("Comparison of {0} with {1}: {2}\n", str2, str3, String.Compare(str2, str3)); // Set the current culture to English in the U.S. Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Console.WriteLine("Current culture: {0}", CultureInfo.CurrentCulture.Name); Console.WriteLine("Comparison of {0} with {1}: {2}", str1, str2, String.Compare(str1, str2)); Console.WriteLine("Comparison of {0} with {1}: {2}\n", str2, str3, String.Compare(str2, str3)); // Perform an ordinal comparison. Console.WriteLine("Ordinal comparison"); Console.WriteLine("Comparison of {0} with {1}: {2}", str1, str2, String.Compare(str1, str2, StringComparison.Ordinal)); Console.WriteLine("Comparison of {0} with {1}: {2}", str2, str3, String.Compare(str2, str3, StringComparison.Ordinal)); } } // The example displays the following output: // Current culture: da-DK // Comparison of Apple with Æble: -1 // Comparison of Æble with AEble: 1 // // Current culture: en-US // Comparison of Apple with Æble: 1 // Comparison of Æble with AEble: 0 // // Ordinal comparison // Comparison of Apple with Æble: -133 // Comparison of Æble with AEble: 133 </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/compare4.vb" name="System.String.Class#21">Imports System.Globalization Imports System.Threading Public Module Example Public Sub Main() Dim str1 As String = "Apple" Dim str2 As String = "Æble" Dim str3 As String = "AEble" ' Set the current culture to Danish in Denmark. Thread.CurrentThread.CurrentCulture = New CultureInfo("da-DK") Console.WriteLine("Current culture: {0}", CultureInfo.CurrentCulture.Name) Console.WriteLine("Comparison of {0} with {1}: {2}", str1, str2, String.Compare(str1, str2)) Console.WriteLine("Comparison of {0} with {1}: {2}", str2, str3, String.Compare(str2, str3)) Console.WriteLine() ' Set the current culture to English in the U.S. Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US") Console.WriteLine("Current culture: {0}", CultureInfo.CurrentCulture.Name) Console.WriteLine("Comparison of {0} with {1}: {2}", str1, str2, String.Compare(str1, str2)) Console.WriteLine("Comparison of {0} with {1}: {2}", str2, str3, String.Compare(str2, str3)) Console.WriteLine() ' Perform an ordinal comparison. Console.WriteLine("Ordinal comparison") Console.WriteLine("Comparison of {0} with {1}: {2}", str1, str2, String.Compare(str1, str2, StringComparison.Ordinal)) Console.WriteLine("Comparison of {0} with {1}: {2}", str2, str3, String.Compare(str2, str3, StringComparison.Ordinal)) End Sub End Module ' The example displays the following output: ' Current culture: da-DK ' Comparison of Apple with Æble: -1 ' Comparison of Æble with AEble: 1 ' ' Current culture: en-US ' Comparison of Apple with Æble: 1 ' Comparison of Æble with AEble: 0 ' ' Ordinal comparison ' Comparison of Apple with Æble: -133 ' Comparison of Æble with AEble: 133 </code></pre><p> Use the following general guidelines to choose an appropriate sorting or string comparison method: </p> <ul> <li><p>If you want the strings to be ordered based on the user's culture, you should order them based on the conventions of the current culture. If the user's culture changes, the order of sorted strings will also change accordingly. For example, a thesaurus application should always sort words based on the user's culture. </p> </li> <li><p>If you want the strings to be ordered based on the conventions of a specific culture, you should order them by supplying a <a class="xref" href="system.globalization.cultureinfo?view=netframework-4.7" data-linktype="relative-path">CultureInfo</a> object that represents that culture to a comparison method. For example, in an application designed to teach students a particular language, you want strings to be ordered based on the conventions of one of the cultures that speaks that language. </p> </li> <li><p>If you want the order of strings to remain unchanged across cultures, you should order them based on the conventions of the invariant culture or use an ordinal comparison. For example, you would use an ordinal sort to organize the names of files, processes, mutexes, or named pipes. </p> </li> <li><p>For a comparison that involves a security decision (such as whether a username is valid), you should always perform an ordinal test for equality by calling an overload of the <a class="xref" href="system.string.equals?view=netframework-4.7" data-linktype="relative-path">Equals</a> method. </p> </li> </ul> <div class="NOTE"><h5>Note</h5><p> The culture-sensitive sorting and casing rules used in string comparison depend on the version of the .NET Framework. In the .NET Framework 4.5 running on the Windows 8 operating system, sorting, casing, normalization, and Unicode character information conforms to the Unicode 6.0 standard. On other operating systems, it conforms to the Unicode 5.0 standard. </p> </div> <p> For more information about word, string, and ordinal sort rules, see the <a class="xref" href="system.globalization.compareoptions?view=netframework-4.7" data-linktype="relative-path">System.Globalization.CompareOptions</a> topic. For additional recommendations on when to use each rule, see <a href="../standard/base-types/best-practices-strings?view=netframework-4.7" data-linktype="relative-path">Best Practices for Using Strings</a>. </p> <p> Ordinarily, you do not call string comparison methods such as <a class="xref" href="system.string.compare?view=netframework-4.7" data-linktype="relative-path">Compare</a> directly to determine the sort order of strings. Instead, comparison methods are called by sorting methods such as <a class="xref" href="system.array.sort?view=netframework-4.7" data-linktype="relative-path">System.Array.Sort</a> or <a class="xref" href="system.collections.generic.list-1.sort?view=netframework-4.7" data-linktype="relative-path">System.Collections.Generic.List<T>.Sort</a>. The following example performs four different sorting operations (word sort using the current culture, word sort using the invariant culture, ordinal sort, and string sort using the invariant culture) without explicitly calling a string comparison method, although they do specify the type of comparison to use. Note that each type of sort produces a unique ordering of strings in its array. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.compare2.cpp" name="System.String.Class#12">using namespace System; using namespace System::Collections; using namespace System::Collections::Generic; using namespace System::Globalization; // IComparer<String> implementation to perform string sort. ref class SCompare : System::Collections::Generic::IComparer<String^> { public: SCompare() {}; virtual int Compare(String^ x, String^ y) { return CultureInfo::CurrentCulture->CompareInfo->Compare(x, y, CompareOptions::StringSort); } }; void main() { array<String^>^ strings = gcnew array<String^> { "coop", "co-op", "cooperative", L"co\x00ADoperative", L"c�ur", "coeur" }; // Perform a word sort using the current (en-US) culture. array<String^>^ current = gcnew array<String^>(strings->Length); strings->CopyTo(current, 0); Array::Sort(current, StringComparer::CurrentCulture); // Perform a word sort using the invariant culture. array<String^>^ invariant = gcnew array<String^>(strings->Length); strings->CopyTo(invariant, 0); Array::Sort(invariant, StringComparer::InvariantCulture); // Perform an ordinal sort. array<String^>^ ordinal = gcnew array<String^>(strings->Length); strings->CopyTo(ordinal, 0); Array::Sort(ordinal, StringComparer::Ordinal); // Perform a string sort using the current culture. array<String^>^ stringSort = gcnew array<String^>(strings->Length); strings->CopyTo(stringSort, 0); Array::Sort(stringSort, gcnew SCompare()); // Display array values Console::WriteLine("{0,13} {1,13} {2,15} {3,13} {4,13}\n", "Original", "Word Sort", "Invariant Word", "Ordinal Sort", "String Sort"); for (int ctr = 0; ctr < strings->Length; ctr++) Console::WriteLine("{0,13} {1,13} {2,15} {3,13} {4,13}", strings[ctr], current[ctr], invariant[ctr], ordinal[ctr], stringSort[ctr] ); } // The example displays the following output: // Original Word Sort Invariant Word Ordinal Sort String Sort // // coop c�ur c�ur co-op co-op // co-op coeur coeur coeur c�ur // cooperative coop coop coop coeur // co�operative co-op co-op cooperative coop // c�ur cooperative cooperative co�operative cooperative // coeur co�operative co�operative c�ur co�operative </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/compare2.cs" name="System.String.Class#12">using System; using System.Collections; using System.Collections.Generic; using System.Globalization; public class Example { public static void Main() { string[] strings = { "coop", "co-op", "cooperative", "co\u00ADoperative", "cœur", "coeur" }; // Perform a word sort using the current (en-US) culture. string[] current = new string[strings.Length]; strings.CopyTo(current, 0); Array.Sort(current, StringComparer.CurrentCulture); // Perform a word sort using the invariant culture. string[] invariant = new string[strings.Length]; strings.CopyTo(invariant, 0); Array.Sort(invariant, StringComparer.InvariantCulture); // Perform an ordinal sort. string[] ordinal = new string[strings.Length]; strings.CopyTo(ordinal, 0); Array.Sort(ordinal, StringComparer.Ordinal); // Perform a string sort using the current culture. string[] stringSort = new string[strings.Length]; strings.CopyTo(stringSort, 0); Array.Sort(stringSort, new SCompare()); // Display array values Console.WriteLine("{0,13} {1,13} {2,15} {3,13} {4,13}\n", "Original", "Word Sort", "Invariant Word", "Ordinal Sort", "String Sort"); for (int ctr = 0; ctr < strings.Length; ctr++) Console.WriteLine("{0,13} {1,13} {2,15} {3,13} {4,13}", strings[ctr], current[ctr], invariant[ctr], ordinal[ctr], stringSort[ctr] ); } } // IComparer<String> implementation to perform string sort. internal class SCompare : IComparer<String> { public int Compare(string x, string y) { return CultureInfo.CurrentCulture.CompareInfo.Compare(x, y, CompareOptions.StringSort); } } // The example displays the following output: // Original Word Sort Invariant Word Ordinal Sort String Sort // // coop cœur cœur co-op co-op // co-op coeur coeur coeur cœur // cooperative coop coop coop coeur // co­operative co-op co-op cooperative coop // cœur cooperative cooperative co­operative cooperative // coeur co­operative co­operative cœur co­operative </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/compare2.vb" name="System.String.Class#12">Imports System.Collections Imports System.Collections.Generic Imports System.Globalization Module Example Public Sub Main() Dim strings() As String = { "coop", "co-op", "cooperative", "co" + ChrW(&h00AD) + "operative", "cœur", "coeur" } ' Perform a word sort using the current (en-US) culture. Dim current(strings.Length - 1) As String strings.CopyTo(current, 0) Array.Sort(current, StringComparer.CurrentCulture) ' Perform a word sort using the invariant culture. Dim invariant(strings.Length - 1) As String strings.CopyTo(invariant, 0) Array.Sort(invariant, StringComparer.InvariantCulture) ' Perform an ordinal sort. Dim ordinal(strings.Length - 1) As String strings.CopyTo(ordinal, 0) Array.Sort(ordinal, StringComparer.Ordinal) ' Perform a string sort using the current culture. Dim stringSort(strings.Length - 1) As String strings.CopyTo(stringSort, 0) Array.Sort(stringSort, new SCompare()) ' Display array values Console.WriteLine("{0,13} {1,13} {2,15} {3,13} {4,13}", "Original", "Word Sort", "Invariant Word", "Ordinal Sort", "String Sort") Console.WriteLine() For ctr As Integer = 0 To strings.Length - 1 Console.WriteLine("{0,13} {1,13} {2,15} {3,13} {4,13}", strings(ctr), current(ctr), invariant(ctr), ordinal(ctr), stringSort(ctr)) Next End Sub End Module ' IComparer<String> implementation to perform string sort. Friend Class SCompare : Implements IComparer(Of String) Public Function Compare(x As String, y As String) As Integer _ Implements IComparer(Of String).Compare Return CultureInfo.CurrentCulture.CompareInfo.Compare(x, y, CompareOptions.StringSort) End Function End Class ' The example displays the following output: ' Original Word Sort Invariant Word Ordinal Sort String Sort ' ' coop cœur cœur co-op co-op ' co-op coeur coeur coeur cœur ' cooperative coop coop coop coeur ' co­operative co-op co-op cooperative coop ' cœur cooperative cooperative co­operative cooperative ' coeur co­operative co­operative cœur co­operative </code></pre><div class="TIP"><h5>Tip</h5><p> Internally, the.NET Framework uses sort keys to support culturallysensitive string comparison. Each character in a string is given several categories of sort weights, including alphabetic, case, and diacritic. A sort key, represented by the <a class="xref" href="system.globalization.sortkey?view=netframework-4.7" data-linktype="relative-path">SortKey</a> class, provides a repository of these weights for a particular string. If your app performs a large number of searching or sorting operations on the same set of strings, you can improve its performance by generating and storing sort keys for all the strings that it uses. When a sort or comparison operation is required, you use the sort keys instead of the strings. For more information, see the <a class="xref" href="system.globalization.sortkey?view=netframework-4.7" data-linktype="relative-path">SortKey</a> class. </p> </div> <p> If you don't specify a string comparison convention, sorting methods such as <a class="xref" href="system.array.sort?view=netframework-4.7#System_Array_Sort_System_Array_" data-linktype="relative-path">System.Array.Sort(Array)</a> perform a culture-sensitive, case-sensitive sort on strings. The following example illustrates how changing the current culture affects the order of sorted strings in an array. It creates an array of three strings. First, it sets the <code>System.Threading.Thread.CurrentThread.CurrentCulture</code> property to en-US and calls the <a class="xref" href="system.array.sort?view=netframework-4.7#System_Array_Sort_System_Array_" data-linktype="relative-path">System.Array.Sort(Array)</a> method. The resulting sort order is based on sorting conventions for the English (United States) culture. Next, the example sets the <code>System.Threading.Thread.CurrentThread.CurrentCulture</code> property to da-DK and calls the <a class="xref" href="system.array.sort?view=netframework-4.7" data-linktype="relative-path">System.Array.Sort</a> method again. Notice how the resulting sort order differs from the en-US results because it uses the sorting conventions for Danish (Denmark). </p> <pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.comparing/cs/sort1.cs" name="Conceptual.Strings.Comparing#3">using System; using System.Globalization; using System.Threading; public class ArraySort { public static void Main(String[] args) { // Create and initialize a new array to store the strings. string[] stringArray = { "Apple", "Æble", "Zebra"}; // Display the values of the array. Console.WriteLine( "The original string array:"); PrintIndexAndValues(stringArray); // Set the CurrentCulture to "en-US". Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); // Sort the values of the array. Array.Sort(stringArray); // Display the values of the array. Console.WriteLine("After sorting for the culture \"en-US\":"); PrintIndexAndValues(stringArray); // Set the CurrentCulture to "da-DK". Thread.CurrentThread.CurrentCulture = new CultureInfo("da-DK"); // Sort the values of the Array. Array.Sort(stringArray); // Display the values of the array. Console.WriteLine("After sorting for the culture \"da-DK\":"); PrintIndexAndValues(stringArray); } public static void PrintIndexAndValues(string[] myArray) { for (int i = myArray.GetLowerBound(0); i <= myArray.GetUpperBound(0); i++ ) Console.WriteLine("[{0}]: {1}", i, myArray[i]); Console.WriteLine(); } } // The example displays the following output: // The original string array: // [0]: Apple // [1]: Æble // [2]: Zebra // // After sorting for the "en-US" culture: // [0]: Æble // [1]: Apple // [2]: Zebra // // After sorting for the culture "da-DK": // [0]: Apple // [1]: Zebra // [2]: Æble </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.strings.comparing/vb/sort1.vb" name="Conceptual.Strings.Comparing#3">Imports System.Globalization Imports System.IO Imports System.Threading Public Class TextToFile Public Shared Sub Main() ' Creates and initializes a new array to store ' these date/time objects. Dim stringArray() As String = { "Apple", "Æble", "Zebra"} ' Displays the values of the array. Console.WriteLine("The original string array:") PrintIndexAndValues(stringArray) ' Set the CurrentCulture to "en-US". Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US") ' Sort the values of the Array. Array.Sort(stringArray) ' Display the values of the array. Console.WriteLine("After sorting for the ""en-US"" culture:") PrintIndexAndValues(stringArray) ' Set the CurrentCulture to "da-DK". Thread.CurrentThread.CurrentCulture = New CultureInfo("da-DK") ' Sort the values of the Array. Array.Sort(stringArray) ' Displays the values of the Array. Console.WriteLine("After sorting for the culture ""da-DK"":") PrintIndexAndValues(stringArray) End Sub Public Shared Sub PrintIndexAndValues(myArray() As String) For i As Integer = myArray.GetLowerBound(0) To myArray.GetUpperBound(0) Console.WriteLine("[{0}]: {1}", i, myArray(i)) Next Console.WriteLine() End Sub End Class ' The example displays the following output: ' The original string array: ' [0]: Apple ' [1]: Æble ' [2]: Zebra ' ' After sorting for the "en-US" culture: ' [0]: Æble ' [1]: Apple ' [2]: Zebra ' ' After sorting for the culture "da-DK": ' [0]: Apple ' [1]: Zebra ' [2]: Æble </code></pre><div class="WARNING"><h5>Warning</h5><p> If your primary purpose in comparing strings is to determine whether they are equal, you should call the <a class="xref" href="system.string.equals?view=netframework-4.7" data-linktype="relative-path">System.String.Equals</a> method. Typically, you should use <a class="xref" href="system.string.equals?view=netframework-4.7" data-linktype="relative-path">Equals</a> to perform an ordinal comparison. The <a class="xref" href="system.string.compare?view=netframework-4.7" data-linktype="relative-path">System.String.Compare</a> method is intended primarily to sort strings. </p> </div> <p> String search methods, such as <a class="xref" href="system.string.startswith?view=netframework-4.7" data-linktype="relative-path">System.String.StartsWith</a> and <a class="xref" href="system.string.indexof?view=netframework-4.7" data-linktype="relative-path">System.String.IndexOf</a>, also can perform culture-sensitive or ordinal string comparisons. The following example illustrates the differences between ordinal and culture-sensitive comparisons using the <a class="xref" href="system.string.indexof?view=netframework-4.7" data-linktype="relative-path">IndexOf</a> method. A culture-sensitive search in which the current culture is English (United States) considers the substring "oe" to match the ligature "œ". Because a soft hyphen (U+00AD) is a zero-width character, the search treats the soft hyphen as equivalent to <a class="xref" href="system.string.empty?view=netframework-4.7" data-linktype="relative-path">Empty</a> and finds a match at the beginning of the string. An ordinal search, on the other hand, does not find a match in either case. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.compare3.cpp" name="System.String.Class#13">using namespace System; void FindInString(String^ s, String^ substring, StringComparison options); void main() { // Search for "oe" and "�u" in "�ufs" and "oeufs". String^ s1 = L"�ufs"; String^ s2 = L"oeufs"; FindInString(s1, "oe", StringComparison::CurrentCulture); FindInString(s1, "oe", StringComparison::Ordinal); FindInString(s2, "�u", StringComparison::CurrentCulture); FindInString(s2, "�u", StringComparison::Ordinal); Console::WriteLine(); String^ s3 = L"co\x00ADoperative"; FindInString(s3, L"\x00AD", StringComparison::CurrentCulture); FindInString(s3, L"\x00AD", StringComparison::Ordinal); } void FindInString(String^ s, String^ substring, StringComparison options) { int result = s->IndexOf(substring, options); if (result != -1) Console::WriteLine("'{0}' found in {1} at position {2}", substring, s, result); else Console::WriteLine("'{0}' not found in {1}", substring, s); } // The example displays the following output: // 'oe' found in oufs at position 0 // 'oe' not found in oufs // 'ou' found in oeufs at position 0 // 'ou' not found in oeufs // // '-' found in co-operative at position 0 // '-' found in co-operative at position 2 </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/compare3.cs" name="System.String.Class#13">using System; public class Example { public static void Main() { // Search for "oe" and "œu" in "œufs" and "oeufs". string s1 = "œufs"; string s2 = "oeufs"; FindInString(s1, "oe", StringComparison.CurrentCulture); FindInString(s1, "oe", StringComparison.Ordinal); FindInString(s2, "œu", StringComparison.CurrentCulture); FindInString(s2, "œu", StringComparison.Ordinal); Console.WriteLine(); string s3 = "co\u00ADoperative"; FindInString(s3, "\u00AD", StringComparison.CurrentCulture); FindInString(s3, "\u00AD", StringComparison.Ordinal); } private static void FindInString(string s, string substring, StringComparison options) { int result = s.IndexOf(substring, options); if (result != -1) Console.WriteLine("'{0}' found in {1} at position {2}", substring, s, result); else Console.WriteLine("'{0}' not found in {1}", substring, s); } } // The example displays the following output: // 'oe' found in œufs at position 0 // 'oe' not found in œufs // 'œu' found in oeufs at position 0 // 'œu' not found in oeufs // // '­' found in co­operative at position 0 // '­' found in co­operative at position 2 </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/compare3.vb" name="System.String.Class#13">Module Example Public Sub Main() ' Search for "oe" and "œu" in "œufs" and "oeufs". Dim s1 As String = "œufs" Dim s2 As String = "oeufs" FindInString(s1, "oe", StringComparison.CurrentCulture) FindInString(s1, "oe", StringComparison.Ordinal) FindInString(s2, "œu", StringComparison.CurrentCulture) FindInString(s2, "œu", StringComparison.Ordinal) Console.WriteLine() Dim softHyphen As String = ChrW(&h00AD) Dim s3 As String = "co" + softHyphen + "operative" FindInString(s3, softHyphen, StringComparison.CurrentCulture) FindInString(s3, softHyphen, StringComparison.Ordinal) End Sub Private Sub FindInString(s As String, substring As String, options As StringComparison) Dim result As Integer = s.IndexOf(substring, options) If result <> -1 Console.WriteLine("'{0}' found in {1} at position {2}", substring, s, result) Else Console.WriteLine("'{0}' not found in {1}", substring, s) End If End Sub End Module ' The example displays the following output: ' 'oe' found in œufs at position 0 ' 'oe' not found in œufs ' 'œu' found in oeufs at position 0 ' 'œu' not found in oeufs ' ' '­' found in co­operative at position 0 ' '­' found in co­operative at position 2 </code></pre><h4 class="accented" id="searching-strings">Searching Strings</h4> <p> String search methods, such as <a class="xref" href="system.string.startswith?view=netframework-4.7" data-linktype="relative-path">System.String.StartsWith</a> and <a class="xref" href="system.string.indexof?view=netframework-4.7" data-linktype="relative-path">System.String.IndexOf</a>, also can perform culture-sensitive or ordinal string comparisons to determine whether a character or substring is found in a specified string. </p> <p> The search methods in the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class that search for an individual character, such as the <a class="xref" href="system.string.indexof?view=netframework-4.7" data-linktype="relative-path">IndexOf</a> method, or one of a set of characters, such as the <a class="xref" href="system.string.indexofany?view=netframework-4.7" data-linktype="relative-path">IndexOfAny</a> method, all perform an ordinal search. To perform a culture-sensitive search for a character, you must call a <a class="xref" href="system.globalization.compareinfo?view=netframework-4.7" data-linktype="relative-path">CompareInfo</a> method such as <a class="xref" href="system.globalization.compareinfo.indexof?view=netframework-4.7#System_Globalization_CompareInfo_IndexOf_System_String_System_Char_" data-linktype="relative-path">System.Globalization.CompareInfo.IndexOf(String, Char)</a> or <a class="xref" href="system.globalization.compareinfo.lastindexof?view=netframework-4.7#System_Globalization_CompareInfo_LastIndexOf_System_String_System_Char_" data-linktype="relative-path">System.Globalization.CompareInfo.LastIndexOf(String, Char)</a>. Note that the results of searching for a character using ordinal and culture-sensitive comparison can be very different. For example, a search for a precomposed Unicode character such as the ligature "Æ" (U+00C6) might match any occurrence of its components in the correct sequence, such as "AE" (U+041U+0045), depending on the culture. The following example illustrates the difference between the <a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_Char_" data-linktype="relative-path">System.String.IndexOf(Char)</a> and <a class="xref" href="system.globalization.compareinfo.indexof?view=netframework-4.7#System_Globalization_CompareInfo_IndexOf_System_String_System_Char_" data-linktype="relative-path">System.Globalization.CompareInfo.IndexOf(String, Char)</a> methods when searching for an individual character. The ligature "æ" (U+00E6) is found in the string "aerial" when using the conventions of the en-US culture, but not when using the conventions of the da-DK culture or when performing an ordinal comparison. </p> <pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/search1.cs" name="System.String.Class#22">using System; using System.Globalization; public class Example { public static void Main() { String[] cultureNames = { "da-DK", "en-US" }; CompareInfo ci; String str = "aerial"; Char ch = 'æ'; // U+00E6 Console.Write("Ordinal comparison -- "); Console.WriteLine("Position of '{0}' in {1}: {2}", ch, str, str.IndexOf(ch)); foreach (var cultureName in cultureNames) { ci = CultureInfo.CreateSpecificCulture(cultureName).CompareInfo; Console.Write("{0} cultural comparison -- ", cultureName); Console.WriteLine("Position of '{0}' in {1}: {2}", ch, str, ci.IndexOf(str, ch)); } } } // The example displays the following output: // Ordinal comparison -- Position of 'æ' in aerial: -1 // da-DK cultural comparison -- Position of 'æ' in aerial: -1 // en-US cultural comparison -- Position of 'æ' in aerial: 0 </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/search1.vb" name="System.String.Class#22">Imports System.Globalization Module Example Public Sub Main() Dim cultureNames() As String = { "da-DK", "en-US" } Dim ci As CompareInfo Dim str As String = "aerial" Dim ch As Char = "æ"c ' U+00E6 Console.Write("Ordinal comparison -- ") Console.WriteLine("Position of '{0}' in {1}: {2}", ch, str, str.IndexOf(ch)) For Each cultureName In cultureNames ci = CultureInfo.CreateSpecificCulture(cultureName).CompareInfo Console.Write("{0} cultural comparison -- ", cultureName) Console.WriteLine("Position of '{0}' in {1}: {2}", ch, str, ci.IndexOf(str, ch)) Next End Sub End Module ' The example displays the following output: ' Ordinal comparison -- Position of 'æ' in aerial: -1 ' da-DK cultural comparison -- Position of 'æ' in aerial: -1 ' en-US cultural comparison -- Position of 'æ' in aerial: 0 </code></pre><p> On the other hand, <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class methods that search for a string rather than a character perform a culture-sensitive search if search options are not explicitly specified by a parameter of type <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">StringComparison</a>. The sole exception is <a class="xref" href="system.string.contains?view=netframework-4.7" data-linktype="relative-path">Contains</a>, which performs an ordinal search. </p> <p><a name="equality"></a> </p> <h4 class="accented" id="testing-for-equality">Testing for equality</h4> <p> Use the <a class="xref" href="system.string.compare?view=netframework-4.7" data-linktype="relative-path">System.String.Compare</a> method to determine the relationship of two strings in the sort order. Typically, this is a culture-sensitive operation. In contrast, call the <a class="xref" href="system.string.equals?view=netframework-4.7" data-linktype="relative-path">System.String.Equals</a> method to test for equality. Because the test for equality usually compares user input with some known string, such as a valid user name, a password, or a file system path, it is typically an ordinal operation. </p> <div class="WARNING"><h5>Warning</h5><p> It is possible to test for equality by calling the <a class="xref" href="system.string.compare?view=netframework-4.7" data-linktype="relative-path">System.String.Compare</a> method and determining whether the return value is zero. However, this practice is not recommended. To determine whether two strings are equal, you should call one of the overloads of the <a class="xref" href="system.string.equals?view=netframework-4.7" data-linktype="relative-path">System.String.Equals</a> method. The preferred overload to call is either the instance <a class="xref" href="system.string.equals?view=netframework-4.7#System_String_Equals_System_String_System_StringComparison_" data-linktype="relative-path">Equals(String, StringComparison)</a> method or the static <a class="xref" href="system.string.equals?view=netframework-4.7#System_String_Equals_System_String_System_String_System_StringComparison_" data-linktype="relative-path">Equals(String, String, StringComparison)</a> method, because both methods include a <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">System.StringComparison</a> parameter that explicitly specifies the type of comparison. </p> </div> <p> The following example illustrates the danger of performing a culture-sensitive comparison for equality when an ordinal one should be used instead. In this case, the intent of the code is to prohibit file system access from URLs that begin with "FILE://" or "file://" by performing a case-insensitive comparison of the beginning of a URL with the string "FILE://". However, if a culture-sensitive comparison is performed using the Turkish (Turkey) culture on a URL that begins with "file://", the comparison for equality fails, because the Turkish uppercase equivalent of the lowercase "i" is "İ" instead of "I". As a result, file system access is inadvertently permitted. On the other hand, if an ordinal comparison is performed, the comparison for equality succeeds, and file system access is denied. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.equals.cpp" name="System.String.Class#11">using namespace System; using namespace System::Globalization; using namespace System::Threading; bool TestForEquality(String^ str, StringComparison cmp); void main() { Thread::CurrentThread->CurrentCulture = CultureInfo::CreateSpecificCulture("tr-TR"); String^ filePath = "file://c:/notes.txt"; Console::WriteLine("Culture-sensitive test for equality:"); if (! TestForEquality(filePath, StringComparison::CurrentCultureIgnoreCase)) Console::WriteLine("Access to {0} is allowed.", filePath); else Console::WriteLine("Access to {0} is not allowed.", filePath); Console::WriteLine("\nOrdinal test for equality:"); if (! TestForEquality(filePath, StringComparison::OrdinalIgnoreCase)) Console::WriteLine("Access to {0} is allowed.", filePath); else Console::WriteLine("Access to {0} is not allowed.", filePath); } bool TestForEquality(String^ str, StringComparison cmp) { int position = str->IndexOf("://"); if (position < 0) return false; String^ substring = str->Substring(0, position); return substring->Equals("FILE", cmp); } // The example displays the following output: // Culture-sensitive test for equality: // Access to file://c:/notes.txt is allowed. // // Ordinal test for equality: // Access to file://c:/notes.txt is not allowed. </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/equality1.cs" name="System.String.Class#11">using System; using System.Globalization; using System.Threading; public class Example { public static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("tr-TR"); string filePath = "file://c:/notes.txt"; Console.WriteLine("Culture-sensitive test for equality:"); if (! TestForEquality(filePath, StringComparison.CurrentCultureIgnoreCase)) Console.WriteLine("Access to {0} is allowed.", filePath); else Console.WriteLine("Access to {0} is not allowed.", filePath); Console.WriteLine("\nOrdinal test for equality:"); if (! TestForEquality(filePath, StringComparison.OrdinalIgnoreCase)) Console.WriteLine("Access to {0} is allowed.", filePath); else Console.WriteLine("Access to {0} is not allowed.", filePath); } private static bool TestForEquality(string str, StringComparison cmp) { int position = str.IndexOf("://"); if (position < 0) return false; string substring = str.Substring(0, position); return substring.Equals("FILE", cmp); } } // The example displays the following output: // Culture-sensitive test for equality: // Access to file://c:/notes.txt is allowed. // // Ordinal test for equality: // Access to file://c:/notes.txt is not allowed. </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/equality1.vb" name="System.String.Class#11">Imports System.Globalization Imports System.Threading Module Example Public Sub Main() Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("tr-TR") Dim filePath As String = "file://c:/notes.txt" Console.WriteLine("Culture-sensitive test for equality:") If Not TestForEquality(filePath, StringComparison.CurrentCultureIgnoreCase) Then Console.WriteLine("Access to {0} is allowed.", filePath) Else Console.WriteLine("Access to {0} is not allowed.", filePath) End If Console.WriteLine() Console.WriteLine("Ordinal test for equality:") If Not TestForEquality(filePath, StringComparison.OrdinalIgnoreCase) Then Console.WriteLine("Access to {0} is allowed.", filePath) Else Console.WriteLine("Access to {0} is not allowed.", filePath) End If End Sub Private Function TestForEquality(str As String, cmp As StringComparison) As Boolean Dim position As Integer = str.IndexOf("://") If position < 0 Then Return False Dim substring As String = str.Substring(0, position) Return substring.Equals("FILE", cmp) End Function End Module ' The example displays the following output: ' Culture-sensitive test for equality: ' Access to file://c:/notes.txt is allowed. ' ' Ordinal test for equality: ' Access to file://c:/notes.txt is not allowed. </code></pre><p><a name="Normalization"></a> </p> <h3 class="accented" id="normalization">Normalization</h3> <p> Some Unicode characters have multiple representations. For example, any of the following code points can represent the letter "ắ": </p> <ul> <li><p>U+1EAF </p> </li> <li><p>U+0103 U+0301 </p> </li> <li><p>U+0061 U+0306 U+0301 </p> </li> </ul> <p> Multiple representations for a single character complicate searching, sorting, matching, and other string operations. </p> <p> The Unicode standard defines a process called normalization that returns one binary representation of a Unicode character for any of its equivalent binary representations. Normalization can use several algorithms, called normalization forms, that follow different rules. The .NET Framework supports Unicode normalization forms C, D, KC, and KD. When strings have been normalized to the same normalization form, they can be compared by using ordinal comparison. </p> <p> An ordinal comparison is a binary comparison of the Unicode scalar value of corresponding <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> objects in each string. The <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class includes a number of methods that can perform an ordinal comparison, including the following: </p> <ul> <li><p>Any overload of the <a class="xref" href="system.string.compare?view=netframework-4.7" data-linktype="relative-path">Compare</a>, <a class="xref" href="system.string.equals?view=netframework-4.7" data-linktype="relative-path">Equals</a>, <a class="xref" href="system.string.startswith?view=netframework-4.7" data-linktype="relative-path">StartsWith</a>, <a class="xref" href="system.string.endswith?view=netframework-4.7" data-linktype="relative-path">EndsWith</a>, <a class="xref" href="system.string.indexof?view=netframework-4.7" data-linktype="relative-path">IndexOf</a>, and <a class="xref" href="system.string.lastindexof?view=netframework-4.7" data-linktype="relative-path">LastIndexOf</a> methods that includes a <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">StringComparison</a> parameter. The method performs an ordinal comparison if you supply a value of <a class="xref" href="system.stringcomparison?view=netframework-4.7" data-linktype="relative-path">System.StringComparison</a> or <a class="xref" href="system.stringcomparison.ordinalignorecase?view=netframework-4.7" data-linktype="relative-path">OrdinalIgnoreCase</a> for this parameter. </p> </li> <li><p>The overloads of the <a class="xref" href="system.string.compareordinal?view=netframework-4.7" data-linktype="relative-path">CompareOrdinal</a> method. </p> </li> <li><p>Methods that use ordinal comparison by default, such as <a class="xref" href="system.string.contains?view=netframework-4.7" data-linktype="relative-path">Contains</a>, <a class="xref" href="system.string.replace?view=netframework-4.7" data-linktype="relative-path">Replace</a>, and <a class="xref" href="system.string.split?view=netframework-4.7" data-linktype="relative-path">Split</a>. </p> </li> <li><p>Methods that search for a <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> value or for the elements in a <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> array in a string instance. Such methods include <a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_Char_" data-linktype="relative-path">IndexOf(Char)</a> and <a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_Char___" data-linktype="relative-path">Split(Char[])</a>. </p> </li> </ul> <p> You can determine whether a string is normalized to normalization form C by calling the <a class="xref" href="system.string.isnormalized?view=netframework-4.7#System_String_IsNormalized" data-linktype="relative-path">System.String.IsNormalized()</a> method, or you can call the <a class="xref" href="system.string.isnormalized?view=netframework-4.7#System_String_IsNormalized_System_Text_NormalizationForm_" data-linktype="relative-path">System.String.IsNormalized(NormalizationForm)</a> method to determine whether a string is normalized to a specified normalization form. You can also call the <a class="xref" href="system.string.normalize?view=netframework-4.7#System_String_Normalize" data-linktype="relative-path">System.String.Normalize()</a> method to convert a string to normalization form C, or you can call the <a class="xref" href="system.string.normalize?view=netframework-4.7#System_String_Normalize_System_Text_NormalizationForm_" data-linktype="relative-path">System.String.Normalize(NormalizationForm)</a> method to convert a string to a specified normalization form. For step-by-step information about normalizing and comparing strings, see the <a class="xref" href="system.string.normalize?view=netframework-4.7#System_String_Normalize" data-linktype="relative-path">Normalize()</a> and <a class="xref" href="system.string.normalize?view=netframework-4.7#System_String_Normalize_System_Text_NormalizationForm_" data-linktype="relative-path">Normalize(NormalizationForm)</a> methods. </p> <p> The following simple example illustrates string normalization. It defines the letter "ố" in three different ways in three different strings, and uses an ordinal comparison for equality to determine that each string differs from the other two strings. It then converts each string to the supported normalization forms, and again performs an ordinal comparison of each string in a specified normalization form. In each case, the second test for equality shows that the strings are equal. </p> <pre><code class="lang-cpp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/string.normalize.cpp" name="System.String.Class#14">using namespace System; using namespace System::Globalization; using namespace System::IO; using namespace System::Text; public ref class Example { private: StreamWriter^ sw; void TestForEquality(... array<String^>^ words) { for (int ctr = 0; ctr <= words->Length - 2; ctr++) for (int ctr2 = ctr + 1; ctr2 <= words->Length - 1; ctr2++) sw->WriteLine("{0} ({1}) = {2} ({3}): {4}", words[ctr], ShowBytes(words[ctr]), words[ctr2], ShowBytes(words[ctr2]), words[ctr]->Equals(words[ctr2], StringComparison::Ordinal)); } String^ ShowBytes(String^ str) { String^ result = nullptr; for each (Char ch in str) result += String::Format("{0} ", Convert::ToUInt16(ch).ToString("X4")); return result->Trim(); } array<String^>^ NormalizeStrings(NormalizationForm nf, ... array<String^>^ words) { for (int ctr = 0; ctr < words->Length; ctr++) if (! words[ctr]->IsNormalized(nf)) words[ctr] = words[ctr]->Normalize(nf); return words; } public: void Execute() { sw = gcnew StreamWriter(".\\TestNorm1.txt"); // Define three versions of the same word. String^ s1 = L"sống"; // create word with U+1ED1 String^ s2 = L"s\x00F4\x0301ng"; String^ s3 = L"so\x0302\x0301ng"; TestForEquality(s1, s2, s3); sw->WriteLine(); // Normalize and compare strings using each normalization form. for each (String^ formName in Enum::GetNames(NormalizationForm::typeid)) { sw->WriteLine("Normalization {0}:\n", formName); NormalizationForm nf = (NormalizationForm) Enum::Parse(NormalizationForm::typeid, formName); array<String^>^ sn = NormalizeStrings(nf, s1, s2, s3 ); TestForEquality(sn); sw->WriteLine("\n"); } sw->Close(); } }; void main() { Example^ ex = gcnew Example(); ex->Execute(); } // The example produces the following output: // The example displays the following output: // sống (0073 1ED1 006E 0067) = sống (0073 00F4 0301 006E 0067): False // sống (0073 1ED1 006E 0067) = sống (0073 006F 0302 0301 006E 0067): False // sống (0073 00F4 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): False // // Normalization FormC: // // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // // // Normalization FormD: // // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // // // Normalization FormKC: // // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // // // Normalization FormKD: // // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True </code></pre><pre><code class="lang-csharp" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Class/cs/normalize1.cs" name="System.String.Class#14">using System; using System.Globalization; using System.IO; using System.Text; public class Example { private static StreamWriter sw; public static void Main() { sw = new StreamWriter(@".\TestNorm1.txt"); // Define three versions of the same word. string s1 = "sống"; // create word with U+1ED1 string s2 = "s\u00F4\u0301ng"; string s3 = "so\u0302\u0301ng"; TestForEquality(s1, s2, s3); sw.WriteLine(); // Normalize and compare strings using each normalization form. foreach (string formName in Enum.GetNames(typeof(NormalizationForm))) { sw.WriteLine("Normalization {0}:\n", formName); NormalizationForm nf = (NormalizationForm) Enum.Parse(typeof(NormalizationForm), formName); string[] sn = NormalizeStrings(nf, s1, s2, s3); TestForEquality(sn); sw.WriteLine("\n"); } sw.Close(); } private static void TestForEquality(params string[] words) { for (int ctr = 0; ctr <= words.Length - 2; ctr++) for (int ctr2 = ctr + 1; ctr2 <= words.Length - 1; ctr2++) sw.WriteLine("{0} ({1}) = {2} ({3}): {4}", words[ctr], ShowBytes(words[ctr]), words[ctr2], ShowBytes(words[ctr2]), words[ctr].Equals(words[ctr2], StringComparison.Ordinal)); } private static string ShowBytes(string str) { string result = null; foreach (var ch in str) result += String.Format("{0} ", Convert.ToUInt16(ch).ToString("X4")); return result.Trim(); } private static string[] NormalizeStrings(NormalizationForm nf, params string[] words) { for (int ctr = 0; ctr < words.Length; ctr++) if (! words[ctr].IsNormalized(nf)) words[ctr] = words[ctr].Normalize(nf); return words; } } // The example displays the following output: // sống (0073 1ED1 006E 0067) = sống (0073 00F4 0301 006E 0067): False // sống (0073 1ED1 006E 0067) = sống (0073 006F 0302 0301 006E 0067): False // sống (0073 00F4 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): False // // Normalization FormC: // // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // // // Normalization FormD: // // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // // // Normalization FormKC: // // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True // // // Normalization FormKD: // // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True // sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True </code></pre><pre><code class="lang-vb" data-src="https://github.com/dotnet/docs/blob/live/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/normalize1.vb" name="System.String.Class#14">Imports System.Globalization Imports System.IO Imports System.Text Module Example Private sw As StreamWriter Public Sub Main() sw = New StreamWriter(".\TestNorm1.txt") ' Define three versions of the same word. Dim s1 As String = "sống" ' create word with U+1ED1 Dim s2 AS String = "s" + ChrW(&h00F4) + ChrW(&h0301) + "ng" Dim s3 As String = "so" + ChrW(&h0302) + ChrW(&h0301) + "ng" TestForEquality(s1, s2, s3) sw.WriteLine() ' Normalize and compare strings using each normalization form. For Each formName In [Enum].GetNames(GetType(NormalizationForm)) sw.WriteLine("Normalization {0}:", formName) Dim nf As NormalizationForm = CType([Enum].Parse(GetType(NormalizationForm), formName), NormalizationForm) Dim sn() As String = NormalizeStrings(nf, s1, s2, s3) TestForEquality(sn) sw.WriteLine(vbCrLf) Next sw.Close() End Sub Private Sub TestForEquality(ParamArray words As String()) For ctr As Integer = 0 To words.Length - 2 For ctr2 As Integer = ctr + 1 To words.Length - 1 sw.WriteLine("{0} ({1}) = {2} ({3}): {4}", words(ctr), ShowBytes(words(ctr)), words(ctr2), ShowBytes(words(ctr2)), words(ctr).Equals(words(ctr2), StringComparison.Ordinal)) Next Next End Sub Private Function ShowBytes(str As String) As String Dim result As String = Nothing For Each ch In str result += String.Format("{0} ", Convert.ToUInt16(ch).ToString("X4")) Next Return result.Trim() End Function Private Function NormalizeStrings(nf As NormalizationForm, ParamArray words() As String) As String() For ctr As Integer = 0 To words.Length - 1 If Not words(ctr).IsNormalized(nf) Then words(ctr) = words(ctr).Normalize(nf) End If Next Return words End Function End Module ' The example displays the following output: ' sống (0073 1ED1 006E 0067) = sống (0073 00F4 0301 006E 0067): False ' sống (0073 1ED1 006E 0067) = sống (0073 006F 0302 0301 006E 0067): False ' sống (0073 00F4 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): False ' ' Normalization FormC: ' ' sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True ' sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True ' sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True ' ' ' Normalization FormD: ' ' sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True ' sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True ' sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True ' ' ' Normalization FormKC: ' ' sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True ' sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True ' sống (0073 1ED1 006E 0067) = sống (0073 1ED1 006E 0067): True ' ' ' Normalization FormKD: ' ' sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True ' sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True ' sống (0073 006F 0302 0301 006E 0067) = sống (0073 006F 0302 0301 006E 0067): True </code></pre><p> For more information about normalization and normalization forms, see <a class="xref" href="system.text.normalizationform?view=netframework-4.7" data-linktype="relative-path">System.Text.NormalizationForm</a>, as well as <a href="http://unicode.org/reports/tr15/" data-linktype="external">Unicode Standard Annex #15: Unicode Normalization Forms</a> and the <a href="http://www.unicode.org/faq/normalization.html" data-linktype="external">Normalization FAQ</a> on the unicode.org website. </p> <p><a name="ByCategory"></a> </p> <h3 class="accented" id="string-operations-by-category">String operations by category</h3> <p> The <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class provides members for comparing strings, testing strings for equality, finding characters or substrings in a string, modifying a string, extracting substrings from a string, combining strings, formatting values, copying a string, and normalizing a string. </p> <h4 class="accented" id="comparing-strings">Comparing strings</h4> <p> You can compare strings to determine their relative position in the sort order by using the following <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> methods: </p> <ul> <li><p><a class="xref" href="system.string.compare?view=netframework-4.7" data-linktype="relative-path">Compare</a> returns an integer that indicates the relationship of one string to a second string in the sort order. </p> </li> <li><p><a class="xref" href="system.string.compareordinal?view=netframework-4.7" data-linktype="relative-path">CompareOrdinal</a> returns an integer that indicates the relationship of one string to a second string based on a comparison of their code points. </p> </li> <li><p><a class="xref" href="system.string.compareto?view=netframework-4.7" data-linktype="relative-path">CompareTo</a> returns an integer that indicates the relationship of the current string instance to a second string in the sort order. The <a class="xref" href="system.string.compareto?view=netframework-4.7#System_String_CompareTo_System_String_" data-linktype="relative-path">CompareTo(String)</a> method provides the <a class="xref" href="system.icomparable?view=netframework-4.7" data-linktype="relative-path">IComparable</a> and <a class="xref" href="system.icomparable-1?view=netframework-4.7" data-linktype="relative-path">IComparable<T></a> implementations for the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class. </p> </li> </ul> <h4 class="accented" id="testing-strings-for-equality">Testing strings for equality</h4> <p> You call the <a class="xref" href="system.string.equals?view=netframework-4.7" data-linktype="relative-path">Equals</a> method to determine whether two strings are equal. The instance <a class="xref" href="system.string.equals?view=netframework-4.7#System_String_Equals_System_String_System_String_System_StringComparison_" data-linktype="relative-path">Equals(String, String, StringComparison)</a> and the static <a class="xref" href="system.string.equals?view=netframework-4.7#System_String_Equals_System_String_System_StringComparison_" data-linktype="relative-path">Equals(String, StringComparison)</a> overloads let you specify whether the comparison is culture-sensitive or ordinal, and whether case is considered or ignored. Most tests for equality are ordinal, and comparisons for equality that determine access to a system resource (such as a file system object) should always be ordinal. </p> <h4 class="accented" id="finding-characters-in-a-string">Finding characters in a string</h4> <p> The <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class includes two kinds of search methods: </p> <ul> <li><p>Methods that return a <a class="xref" href="system.boolean?view=netframework-4.7" data-linktype="relative-path">Boolean</a> value to indicate whether a particular substring is present in a string instance. These include the <a class="xref" href="system.string.contains?view=netframework-4.7" data-linktype="relative-path">Contains</a>, <a class="xref" href="system.string.endswith?view=netframework-4.7" data-linktype="relative-path">EndsWith</a>, and <a class="xref" href="system.string.startswith?view=netframework-4.7" data-linktype="relative-path">StartsWith</a> methods. </p> </li> <li><p>Methods that indicate the starting position of a substring in a string instance. These include the <a class="xref" href="system.string.indexof?view=netframework-4.7" data-linktype="relative-path">IndexOf</a>, <a class="xref" href="system.string.indexofany?view=netframework-4.7" data-linktype="relative-path">IndexOfAny</a>, <a class="xref" href="system.string.lastindexof?view=netframework-4.7" data-linktype="relative-path">LastIndexOf</a>, and <a class="xref" href="system.string.lastindexofany?view=netframework-4.7" data-linktype="relative-path">LastIndexOfAny</a> methods. </p> </li> </ul> <div class="WARNING"><h5>Warning</h5><p> If you want to search a string for a particular pattern rather than a specific substring, you should use regular expressions. For more information, see <a href="../standard/base-types/regular-expressions?view=netframework-4.7" data-linktype="relative-path">.NET Framework Regular Expressions</a>. </p> </div> <h4 class="accented" id="modifying-a-string">Modifying a string</h4> <p> The <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class includes the following methods that appear to modify the value of a string: </p> <ul> <li><p><a class="xref" href="system.string.insert?view=netframework-4.7" data-linktype="relative-path">Insert</a> inserts a string into the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> instance. </p> </li> <li><p><a class="xref" href="system.string.padleft?view=netframework-4.7" data-linktype="relative-path">PadLeft</a> inserts one or more occurrences of a specified character at the beginning of a string. </p> </li> <li><p><a class="xref" href="system.string.padright?view=netframework-4.7" data-linktype="relative-path">PadRight</a> inserts one or more occurrences of a specified character at the beginning of a string. </p> </li> <li><p><a class="xref" href="system.string.remove?view=netframework-4.7" data-linktype="relative-path">Remove</a> deletes a substring from the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> instance. </p> </li> <li><p><a class="xref" href="system.string.replace?view=netframework-4.7" data-linktype="relative-path">Replace</a> replaces a substring with another substring in the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> instance. </p> </li> <li><p><a class="xref" href="system.string.tolower?view=netframework-4.7" data-linktype="relative-path">ToLower</a> and <a class="xref" href="system.string.tolowerinvariant?view=netframework-4.7" data-linktype="relative-path">ToLowerInvariant</a> convert all the characters in a string to lowercase. </p> </li> <li><p><a class="xref" href="system.string.toupper?view=netframework-4.7" data-linktype="relative-path">ToUpper</a> and <a class="xref" href="system.string.toupperinvariant?view=netframework-4.7" data-linktype="relative-path">ToUpperInvariant</a> convert all the characters in a string to uppercase. </p> </li> <li><p><a class="xref" href="system.string.trim?view=netframework-4.7" data-linktype="relative-path">Trim</a> removes all occurrences of a character from the beginning and end of a string. </p> </li> <li><p><a class="xref" href="system.string.trimend?view=netframework-4.7" data-linktype="relative-path">TrimEnd</a> removes all occurrences of a character from the end of a string. </p> </li> <li><p><a class="xref" href="system.string.trimstart?view=netframework-4.7" data-linktype="relative-path">TrimStart</a> removes all occurrences of a character from the beginning of a string. </p> </li> </ul> <div class="IMPORTANT"><h5>Important</h5><p> All string modification methods return a new <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object. They do not modify the value of the current instance. </p> </div> <h4 class="accented" id="extracting-substrings-from-a-string">Extracting substrings from a string</h4> <p> The <a class="xref" href="system.string.split?view=netframework-4.7" data-linktype="relative-path">System.String.Split</a> method separates a single string into multiple strings. Overloads of the method allow you to specify multiple delimiters, to determine the maximum number of substrings that the method extracts, and to determine whether empty strings (which occur when delimiters are adjacent) are included among the returned strings. </p> <h4 class="accented" id="combining-strings">Combining strings</h4> <p> The following <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> methods can be used for string concatenation: </p> <ul> <li><p><a class="xref" href="system.string.concat?view=netframework-4.7" data-linktype="relative-path">Concat</a> combines one or more substrings into a single string. </p> </li> <li><p><a class="xref" href="system.string.join?view=netframework-4.7" data-linktype="relative-path">Join</a> concatenates one or more substrings into a single element and adds a separator between each substring. </p> </li> </ul> <h4 class="accented" id="formatting-values">Formatting values</h4> <p> The <a class="xref" href="system.string.format?view=netframework-4.7" data-linktype="relative-path">System.String.Format</a> method uses the composite formatting feature to replace one or more placeholders in a string with the string representation of some object or value. The <a class="xref" href="system.string.format?view=netframework-4.7" data-linktype="relative-path">Format</a> method is often used to do the following: </p> <ul> <li><p>To embed the string representation of a numeric value in a string. </p> </li> <li><p>To embed the string representation of a date and time value in a string. </p> </li> <li><p>To embed the string representation of an enumeration value in a string. </p> </li> <li><p>To embed the string representation of some object that supports the <a class="xref" href="system.iformattable?view=netframework-4.7" data-linktype="relative-path">IFormattable</a> interface in a string. </p> </li> <li><p>To right-justify or left-justify a substring in a field within a larger string. </p> </li> </ul> <p> For detailed information about formatting operations and examples, see the <a class="xref" href="system.string.format?view=netframework-4.7" data-linktype="relative-path">Format</a> overload summary. </p> <h4 class="accented" id="copying-a-string">Copying a string</h4> <p> You can call the following <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> methods to make a copy of a string: </p> <ul> <li><p><a class="xref" href="system.string.clone?view=netframework-4.7" data-linktype="relative-path">Clone</a> returns a reference to an existing <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object. </p> </li> <li><p><a class="xref" href="system.string.copy?view=netframework-4.7" data-linktype="relative-path">Copy</a> creates a copy of an existing string. </p> </li> <li><p><a class="xref" href="system.string.copyto?view=netframework-4.7" data-linktype="relative-path">CopyTo</a> copies a portion of a string to a character array. </p> </li> </ul> <h4 class="accented" id="normalizing-a-string">Normalizing a string</h4> <p> In Unicode, a single character can have multiple code points. Normalization converts these equivalent characters into the same binary representation. The <a class="xref" href="system.string.normalize?view=netframework-4.7" data-linktype="relative-path">System.String.Normalize</a> method performs the normalization, and the <a class="xref" href="system.string.isnormalized?view=netframework-4.7" data-linktype="relative-path">System.String.IsNormalized</a> method determines whether a string is normalized. </p> <p> For more information and an example, see the <a href="#Normalization" data-linktype="self-bookmark">Normalization</a> section earlier in this topic.</p> <h2 class="accented ">Constructors </h2> <table class="nameValue"> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.-ctor?view=netframework-4.7#System_String__ctor_System_Char__" data-linktype="relative-path">String(​Char*)</a></span> </td> <td> <p>Initializes a new instance of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class to the value indicated by a specified pointer to an array of Unicode characters.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.-ctor?view=netframework-4.7#System_String__ctor_System_Char___" data-linktype="relative-path">String(​Char[])</a></span> </td> <td> <p>Initializes a new instance of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class to the value indicated by an array of Unicode characters.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.-ctor?view=netframework-4.7#System_String__ctor_System_SByte__" data-linktype="relative-path">String(​SByte*)</a></span> </td> <td> <p>Initializes a new instance of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class to the value indicated by a pointer to an array of 8-bit signed integers.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.-ctor?view=netframework-4.7#System_String__ctor_System_Char_System_Int32_" data-linktype="relative-path">String(​Char, ​Int32)</a></span> </td> <td> <p>Initializes a new instance of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class to the value indicated by a specified Unicode character repeated a specified number of times.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.-ctor?view=netframework-4.7#System_String__ctor_System_Char__System_Int32_System_Int32_" data-linktype="relative-path">String(​Char*, ​Int32, ​Int32)</a></span> </td> <td> <p>Initializes a new instance of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class to the value indicated by a specified pointer to an array of Unicode characters, a starting character position within that array, and a length.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.-ctor?view=netframework-4.7#System_String__ctor_System_Char___System_Int32_System_Int32_" data-linktype="relative-path">String(​Char[], ​Int32, ​Int32)</a></span> </td> <td> <p>Initializes a new instance of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class to the value indicated by an array of Unicode characters, a starting character position within that array, and a length.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.-ctor?view=netframework-4.7#System_String__ctor_System_SByte__System_Int32_System_Int32_" data-linktype="relative-path">String(​SByte*, ​Int32, ​Int32)</a></span> </td> <td> <p>Initializes a new instance of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class to the value indicated by a specified pointer to an array of 8-bit signed integers, a starting position within that array, and a length.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.-ctor?view=netframework-4.7#System_String__ctor_System_SByte__System_Int32_System_Int32_System_Text_Encoding_" data-linktype="relative-path">String(​SByte*, ​Int32, ​Int32, ​Encoding)</a></span> </td> <td> <p>Initializes a new instance of the <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> class to the value indicated by a specified pointer to an array of 8-bit signed integers, a starting position within that array, a length, and an <a class="xref" href="system.text.encoding?view=netframework-4.7" data-linktype="relative-path">Encoding</a> object.</p> </td> </tr> </table> <h2 class="accented ">Fields </h2> <table class="nameValue"> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.empty?view=netframework-4.7" data-linktype="relative-path">Empty</a></span> </td> <td> <p>Represents the empty string. This field is read-only.</p> </td> </tr> </table> <h2 class="accented ">Properties </h2> <table class="nameValue"> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.chars?view=netframework-4.7#System_String_Chars_System_Int32_" data-linktype="relative-path">Chars[​Int32]</a></span> </td> <td> <p>Gets the <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> object at a specified position in the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.length?view=netframework-4.7#System_String_Length" data-linktype="relative-path">Length</a></span> </td> <td> <p>Gets the number of characters in the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object.</p> </td> </tr> </table> <h2 class="accented ">Methods </h2> <table class="nameValue"> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.clone?view=netframework-4.7#System_String_Clone" data-linktype="relative-path">Clone()</a></span> </td> <td> <p>Returns a reference to this instance of <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_Int32_System_String_System_Int32_System_Int32_System_Boolean_System_Globalization_CultureInfo_" data-linktype="relative-path">Compare(​String, ​Int32, ​String, ​Int32, ​Int32, ​Boolean, ​Culture​Info)</a></span> </td> <td> <p>Compares substrings of two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects, ignoring or honoring their case and using culture-specific information to influence the comparison, and returns an integer that indicates their relative position in the sort order.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_Int32_System_String_System_Int32_System_Int32_System_StringComparison_" data-linktype="relative-path">Compare(​String, ​Int32, ​String, ​Int32, ​Int32, ​String​Comparison)</a></span> </td> <td> <p>Compares substrings of two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects using the specified rules, and returns an integer that indicates their relative position in the sort order.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_Int32_System_String_System_Int32_System_Int32_System_Boolean_" data-linktype="relative-path">Compare(​String, ​Int32, ​String, ​Int32, ​Int32, ​Boolean)</a></span> </td> <td> <p>Compares substrings of two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects, ignoring or honoring their case, and returns an integer that indicates their relative position in the sort order.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_Int32_System_String_System_Int32_System_Int32_" data-linktype="relative-path">Compare(​String, ​Int32, ​String, ​Int32, ​Int32)</a></span> </td> <td> <p>Compares substrings of two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects and returns an integer that indicates their relative position in the sort order.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_" data-linktype="relative-path">Compare(​String, ​String)</a></span> </td> <td> <p>Compares two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects and returns an integer that indicates their relative position in the sort order.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_System_Boolean_System_Globalization_CultureInfo_" data-linktype="relative-path">Compare(​String, ​String, ​Boolean, ​Culture​Info)</a></span> </td> <td> <p>Compares two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects, ignoring or honoring their case, and using culture-specific information to influence the comparison, and returns an integer that indicates their relative position in the sort order.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_System_StringComparison_" data-linktype="relative-path">Compare(​String, ​String, ​String​Comparison)</a></span> </td> <td> <p>Compares two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects using the specified rules, and returns an integer that indicates their relative position in the sort order.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_System_Boolean_" data-linktype="relative-path">Compare(​String, ​String, ​Boolean)</a></span> </td> <td> <p>Compares two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects, ignoring or honoring their case, and returns an integer that indicates their relative position in the sort order.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_Int32_System_String_System_Int32_System_Int32_System_Globalization_CultureInfo_System_Globalization_CompareOptions_" data-linktype="relative-path">Compare(​String, ​Int32, ​String, ​Int32, ​Int32, ​Culture​Info, ​Compare​Options)</a></span> </td> <td> <p>Compares substrings of two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two substrings to each other in the sort order.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.compare?view=netframework-4.7#System_String_Compare_System_String_System_String_System_Globalization_CultureInfo_System_Globalization_CompareOptions_" data-linktype="relative-path">Compare(​String, ​String, ​Culture​Info, ​Compare​Options)</a></span> </td> <td> <p>Compares two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two strings to each other in the sort order.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.compareordinal?view=netframework-4.7#System_String_CompareOrdinal_System_String_System_Int32_System_String_System_Int32_System_Int32_" data-linktype="relative-path">Compare​Ordinal(​String, ​Int32, ​String, ​Int32, ​Int32)</a></span> </td> <td> <p>Compares substrings of two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects by evaluating the numeric values of the corresponding <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> objects in each substring.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.compareordinal?view=netframework-4.7#System_String_CompareOrdinal_System_String_System_String_" data-linktype="relative-path">Compare​Ordinal(​String, ​String)</a></span> </td> <td> <p>Compares two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects by evaluating the numeric values of the corresponding <a class="xref" href="system.char?view=netframework-4.7" data-linktype="relative-path">Char</a> objects in each string.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.compareto?view=netframework-4.7#System_String_CompareTo_System_Object_" data-linktype="relative-path">Compare​To(​Object)</a></span> </td> <td> <p>Compares this instance with a specified <a class="xref" href="system.object?view=netframework-4.7" data-linktype="relative-path">Object</a> and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified <a class="xref" href="system.object?view=netframework-4.7" data-linktype="relative-path">Object</a>.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.compareto?view=netframework-4.7#System_String_CompareTo_System_String_" data-linktype="relative-path">Compare​To(​String)</a></span> </td> <td> <p>Compares this instance with a specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_String_System_String_System_String_System_String_" data-linktype="relative-path">Concat(​String, ​String, ​String, ​String)</a></span> </td> <td> <p>Concatenates four specified instances of <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>.</p> </td> </tr> <tr data-moniker=" netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_Object_System_Object_System_Object_System_Object_" data-linktype="relative-path">Concat(​Object, ​Object, ​Object, ​Object)</a></span> </td> <td> <p>Concatenates the string representations of four specified objects and any objects specified in an optional variable length parameter list.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_Object_System_Object_System_Object_" data-linktype="relative-path">Concat(​Object, ​Object, ​Object)</a></span> </td> <td> <p>Concatenates the string representations of three specified objects.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_String_System_String_" data-linktype="relative-path">Concat(​String, ​String)</a></span> </td> <td> <p>Concatenates two specified instances of <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_String_System_String_System_String_" data-linktype="relative-path">Concat(​String, ​String, ​String)</a></span> </td> <td> <p>Concatenates three specified instances of <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_String___" data-linktype="relative-path">Concat(​String[])</a></span> </td> <td> <p>Concatenates the elements of a specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> array.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_Object___" data-linktype="relative-path">Concat(​Object[])</a></span> </td> <td> <p>Concatenates the string representations of the elements in a specified <a class="xref" href="system.object?view=netframework-4.7" data-linktype="relative-path">Object</a> array.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_Object_" data-linktype="relative-path">Concat(​Object)</a></span> </td> <td> <p>Creates the string representation of a specified object.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_Collections_Generic_IEnumerable_System_String__" data-linktype="relative-path">Concat(​IEnumerable<​String>)</a></span> </td> <td> <p>Concatenates the members of a constructed <a class="xref" href="system.collections.generic.ienumerable-1?view=netframework-4.7" data-linktype="relative-path">IEnumerable<T></a> collection of type <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat_System_Object_System_Object_" data-linktype="relative-path">Concat(​Object, ​Object)</a></span> </td> <td> <p>Concatenates the string representations of two specified objects.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.concat?view=netframework-4.7#System_String_Concat__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Concat<​T>(​IEnumerable<​T>)</a></span> </td> <td> <p>Concatenates the members of an <a class="xref" href="system.collections.generic.ienumerable-1?view=netframework-4.7" data-linktype="relative-path">IEnumerable<T></a> implementation.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.contains?view=netframework-4.7#System_String_Contains_System_String_" data-linktype="relative-path">Contains(​String)</a></span> </td> <td> <p>Returns a value indicating whether a specified substring occurs within this string.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.copy?view=netframework-4.7#System_String_Copy_System_String_" data-linktype="relative-path">Copy(​String)</a></span> </td> <td> <p>Creates a new instance of <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> with the same value as a specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.copyto?view=netframework-4.7#System_String_CopyTo_System_Int32_System_Char___System_Int32_System_Int32_" data-linktype="relative-path">Copy​To(​Int32, ​Char[], ​Int32, ​Int32)</a></span> </td> <td> <p>Copies a specified number of characters from a specified position in this instance to a specified position in an array of Unicode characters.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.endswith?view=netframework-4.7#System_String_EndsWith_System_String_System_Boolean_System_Globalization_CultureInfo_" data-linktype="relative-path">Ends​With(​String, ​Boolean, ​Culture​Info)</a></span> </td> <td> <p>Determines whether the end of this string instance matches the specified string when compared using the specified culture.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.endswith?view=netframework-4.7#System_String_EndsWith_System_String_System_StringComparison_" data-linktype="relative-path">Ends​With(​String, ​String​Comparison)</a></span> </td> <td> <p>Determines whether the end of this string instance matches the specified string when compared using the specified comparison option.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.endswith?view=netframework-4.7#System_String_EndsWith_System_String_" data-linktype="relative-path">Ends​With(​String)</a></span> </td> <td> <p>Determines whether the end of this string instance matches the specified string.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.endswith?view=netframework-4.7#System_String_EndsWith_System_Char_" data-linktype="relative-path">Ends​With(​Char)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.equals?view=netframework-4.7#System_String_Equals_System_Object_" data-linktype="relative-path">Equals(​Object)</a></span> </td> <td> <p>Determines whether this instance and a specified object, which must also be a <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object, have the same value.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.equals?view=netframework-4.7#System_String_Equals_System_String_" data-linktype="relative-path">Equals(​String)</a></span> </td> <td> <p>Determines whether this instance and another specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object have the same value.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.equals?view=netframework-4.7#System_String_Equals_System_String_System_String_" data-linktype="relative-path">Equals(​String, ​String)</a></span> </td> <td> <p>Determines whether two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects have the same value.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.equals?view=netframework-4.7#System_String_Equals_System_String_System_StringComparison_" data-linktype="relative-path">Equals(​String, ​String​Comparison)</a></span> </td> <td> <p>Determines whether this string and a specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object have the same value. A parameter specifies the culture, case, and sort rules used in the comparison.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.equals?view=netframework-4.7#System_String_Equals_System_String_System_String_System_StringComparison_" data-linktype="relative-path">Equals(​String, ​String, ​String​Comparison)</a></span> </td> <td> <p>Determines whether two specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> objects have the same value. A parameter specifies the culture, case, and sort rules used in the comparison.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.format?view=netframework-4.7#System_String_Format_System_IFormatProvider_System_String_System_Object_System_Object_System_Object_" data-linktype="relative-path">Format(​IFormat​Provider, ​String, ​Object, ​Object, ​Object)</a></span> </td> <td> <p>Replaces the format items in a specified string with the string representation of three specified objects. An parameter supplies culture-specific formatting information.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.format?view=netframework-4.7#System_String_Format_System_String_System_Object_System_Object_System_Object_" data-linktype="relative-path">Format(​String, ​Object, ​Object, ​Object)</a></span> </td> <td> <p>Replaces the format items in a specified string with the string representation of three specified objects.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.format?view=netframework-4.7#System_String_Format_System_IFormatProvider_System_String_System_Object_System_Object_" data-linktype="relative-path">Format(​IFormat​Provider, ​String, ​Object, ​Object)</a></span> </td> <td> <p>Replaces the format items in a specified string with the string representation of two specified objects. A parameter supplies culture-specific formatting information.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.format?view=netframework-4.7#System_String_Format_System_String_System_Object_System_Object_" data-linktype="relative-path">Format(​String, ​Object, ​Object)</a></span> </td> <td> <p>Replaces the format items in a specified string with the string representation of two specified objects.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.format?view=netframework-4.7#System_String_Format_System_IFormatProvider_System_String_System_Object_" data-linktype="relative-path">Format(​IFormat​Provider, ​String, ​Object)</a></span> </td> <td> <p>Replaces the format item or items in a specified string with the string representation of the corresponding object. A parameter supplies culture-specific formatting information.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.format?view=netframework-4.7#System_String_Format_System_String_System_Object___" data-linktype="relative-path">Format(​String, ​Object[])</a></span> </td> <td> <p>Replaces the format item in a specified string with the string representation of a corresponding object in a specified array.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.format?view=netframework-4.7#System_String_Format_System_String_System_Object_" data-linktype="relative-path">Format(​String, ​Object)</a></span> </td> <td> <p>Replaces one or more format items in a specified string with the string representation of a specified object.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.format?view=netframework-4.7#System_String_Format_System_IFormatProvider_System_String_System_Object___" data-linktype="relative-path">Format(​IFormat​Provider, ​String, ​Object[])</a></span> </td> <td> <p>Replaces the format items in a specified string with the string representations of corresponding objects in a specified array. A parameter supplies culture-specific formatting information.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.getenumerator?view=netframework-4.7#System_String_GetEnumerator" data-linktype="relative-path">Get​Enumerator()</a></span> </td> <td> <p>Retrieves an object that can iterate through the individual characters in this string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.gethashcode?view=netframework-4.7#System_String_GetHashCode" data-linktype="relative-path">Get​Hash​Code()</a></span> </td> <td> <p>Returns the hash code for this string.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.gethashcode?view=netframework-4.7#System_String_GetHashCode_System_StringComparison_" data-linktype="relative-path">Get​Hash​Code(​String​Comparison)</a></span> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.gettypecode?view=netframework-4.7#System_String_GetTypeCode" data-linktype="relative-path">Get​Type​Code()</a></span> </td> <td> <p>Returns the <a class="xref" href="system.typecode?view=netframework-4.7" data-linktype="relative-path">TypeCode</a> for class <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_String_System_Int32_System_Int32_" data-linktype="relative-path">Index​Of(​String, ​Int32, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position and examines a specified number of character positions.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_String_System_Int32_System_Int32_System_StringComparison_" data-linktype="relative-path">Index​Of(​String, ​Int32, ​Int32, ​String​Comparison)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence of the specified string in the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object. Parameters specify the starting search position in the current string, the number of characters in the current string to search, and the type of search to use for the specified string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_String_System_Int32_System_StringComparison_" data-linktype="relative-path">Index​Of(​String, ​Int32, ​String​Comparison)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence of the specified string in the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object. Parameters specify the starting search position in the current string and the type of search to use for the specified string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_Char_System_Int32_System_Int32_" data-linktype="relative-path">Index​Of(​Char, ​Int32, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence of the specified character in this instance. The search starts at a specified character position and examines a specified number of character positions.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_String_" data-linktype="relative-path">Index​Of(​String)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence of the specified string in this instance.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_String_System_Int32_" data-linktype="relative-path">Index​Of(​String, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_Char_System_Int32_" data-linktype="relative-path">Index​Of(​Char, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence of the specified Unicode character in this string. The search starts at a specified character position.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_String_System_StringComparison_" data-linktype="relative-path">Index​Of(​String, ​String​Comparison)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence of the specified string in the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object. A parameter specifies the type of search to use for the specified string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexof?view=netframework-4.7#System_String_IndexOf_System_Char_" data-linktype="relative-path">Index​Of(​Char)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence of the specified Unicode character in this string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexofany?view=netframework-4.7#System_String_IndexOfAny_System_Char___" data-linktype="relative-path">Index​Of​Any(​Char[])</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexofany?view=netframework-4.7#System_String_IndexOfAny_System_Char___System_Int32_" data-linktype="relative-path">Index​Of​Any(​Char[], ​Int32)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.indexofany?view=netframework-4.7#System_String_IndexOfAny_System_Char___System_Int32_System_Int32_" data-linktype="relative-path">Index​Of​Any(​Char[], ​Int32, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.insert?view=netframework-4.7#System_String_Insert_System_Int32_System_String_" data-linktype="relative-path">Insert(​Int32, ​String)</a></span> </td> <td> <p>Returns a new string in which a specified string is inserted at a specified index position in this instance.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.intern?view=netframework-4.7#System_String_Intern_System_String_" data-linktype="relative-path">Intern(​String)</a></span> </td> <td> <p>Retrieves the system's reference to the specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.isinterned?view=netframework-4.7#System_String_IsInterned_System_String_" data-linktype="relative-path">Is​Interned(​String)</a></span> </td> <td> <p>Retrieves a reference to a specified <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.isnormalized?view=netframework-4.7#System_String_IsNormalized" data-linktype="relative-path">Is​Normalized()</a></span> </td> <td> <p>Indicates whether this string is in Unicode normalization form C.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.isnormalized?view=netframework-4.7#System_String_IsNormalized_System_Text_NormalizationForm_" data-linktype="relative-path">Is​Normalized(​Normalization​Form)</a></span> </td> <td> <p>Indicates whether this string is in the specified Unicode normalization form.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.isnullorempty?view=netframework-4.7#System_String_IsNullOrEmpty_System_String_" data-linktype="relative-path">Is​Null​Or​Empty(​String)</a></span> </td> <td> <p>Indicates whether the specified string is <code>null</code> or an <a class="xref" href="system.string.empty?view=netframework-4.7" data-linktype="relative-path">Empty</a> string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.isnullorwhitespace?view=netframework-4.7#System_String_IsNullOrWhiteSpace_System_String_" data-linktype="relative-path">Is​Null​Or​White​Space(​String)</a></span> </td> <td> <p>Indicates whether a specified string is <code>null</code>, empty, or consists only of white-space characters.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.join?view=netframework-4.7#System_String_Join_System_String_System_String___System_Int32_System_Int32_" data-linktype="relative-path">Join(​String, ​String[], ​Int32, ​Int32)</a></span> </td> <td> <p>Concatenates the specified elements of a string array, using the specified separator between each element.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.join?view=netframework-4.7#System_String_Join_System_String_System_String___" data-linktype="relative-path">Join(​String, ​String[])</a></span> </td> <td> <p>Concatenates all the elements of a string array, using the specified separator between each element.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.join?view=netframework-4.7#System_String_Join_System_String_System_Object___" data-linktype="relative-path">Join(​String, ​Object[])</a></span> </td> <td> <p>Concatenates the elements of an object array, using the specified separator between each element.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.join?view=netframework-4.7#System_String_Join_System_Char_System_String___System_Int32_System_Int32_" data-linktype="relative-path">Join(​Char, ​String[], ​Int32, ​Int32)</a></span> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.join?view=netframework-4.7#System_String_Join_System_Char_System_String___" data-linktype="relative-path">Join(​Char, ​String[])</a></span> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.join?view=netframework-4.7#System_String_Join_System_Char_System_Object___" data-linktype="relative-path">Join(​Char, ​Object[])</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.join?view=netframework-4.7#System_String_Join_System_String_System_Collections_Generic_IEnumerable_System_String__" data-linktype="relative-path">Join(​String, ​IEnumerable<​String>)</a></span> </td> <td> <p>Concatenates the members of a constructed <a class="xref" href="system.collections.generic.ienumerable-1?view=netframework-4.7" data-linktype="relative-path">IEnumerable<T></a> collection of type <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>, using the specified separator between each member.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.join?view=netframework-4.7#System_String_Join__1_System_Char_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Join<​T>(​Char, ​IEnumerable<​T>)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.join?view=netframework-4.7#System_String_Join__1_System_String_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Join<​T>(​String, ​IEnumerable<​T>)</a></span> </td> <td> <p>Concatenates the members of a collection, using the specified separator between each member.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexof?view=netframework-4.7#System_String_LastIndexOf_System_String_System_Int32_System_Int32_System_StringComparison_" data-linktype="relative-path">Last​Index​Of(​String, ​Int32, ​Int32, ​String​Comparison)</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for the specified number of character positions. A parameter specifies the type of comparison to perform when searching for the specified string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexof?view=netframework-4.7#System_String_LastIndexOf_System_String_System_Int32_System_StringComparison_" data-linktype="relative-path">Last​Index​Of(​String, ​Int32, ​String​Comparison)</a></span> </td> <td> <p>Reports the zero-based index of the last occurrence of a specified string within the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object. The search starts at a specified character position and proceeds backward toward the beginning of the string. A parameter specifies the type of comparison to perform when searching for the specified string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexof?view=netframework-4.7#System_String_LastIndexOf_System_Char_System_Int32_System_Int32_" data-linktype="relative-path">Last​Index​Of(​Char, ​Int32, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence of the specified Unicode character in a substring within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexof?view=netframework-4.7#System_String_LastIndexOf_System_String_System_StringComparison_" data-linktype="relative-path">Last​Index​Of(​String, ​String​Comparison)</a></span> </td> <td> <p>Reports the zero-based index of the last occurrence of a specified string within the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object. A parameter specifies the type of search to use for the specified string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexof?view=netframework-4.7#System_String_LastIndexOf_System_String_System_Int32_System_Int32_" data-linktype="relative-path">Last​Index​Of(​String, ​Int32, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexof?view=netframework-4.7#System_String_LastIndexOf_System_Char_System_Int32_" data-linktype="relative-path">Last​Index​Of(​Char, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexof?view=netframework-4.7#System_String_LastIndexOf_System_String_" data-linktype="relative-path">Last​Index​Of(​String)</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence of a specified string within this instance.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexof?view=netframework-4.7#System_String_LastIndexOf_System_Char_" data-linktype="relative-path">Last​Index​Of(​Char)</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexof?view=netframework-4.7#System_String_LastIndexOf_System_String_System_Int32_" data-linktype="relative-path">Last​Index​Of(​String, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexofany?view=netframework-4.7#System_String_LastIndexOfAny_System_Char___" data-linktype="relative-path">Last​Index​Of​Any(​Char[])</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexofany?view=netframework-4.7#System_String_LastIndexOfAny_System_Char___System_Int32_" data-linktype="relative-path">Last​Index​Of​Any(​Char[], ​Int32)</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. The search starts at a specified character position and proceeds backward toward the beginning of the string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.lastindexofany?view=netframework-4.7#System_String_LastIndexOfAny_System_Char___System_Int32_System_Int32_" data-linktype="relative-path">Last​Index​Of​Any(​Char[], ​Int32, ​Int32)</a></span> </td> <td> <p>Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.normalize?view=netframework-4.7#System_String_Normalize_System_Text_NormalizationForm_" data-linktype="relative-path">Normalize(​Normalization​Form)</a></span> </td> <td> <p>Returns a new string whose textual value is the same as this string, but whose binary representation is in the specified Unicode normalization form.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.normalize?view=netframework-4.7#System_String_Normalize" data-linktype="relative-path">Normalize()</a></span> </td> <td> <p>Returns a new string whose textual value is the same as this string, but whose binary representation is in Unicode normalization form C.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.padleft?view=netframework-4.7#System_String_PadLeft_System_Int32_" data-linktype="relative-path">Pad​Left(​Int32)</a></span> </td> <td> <p>Returns a new string that right-aligns the characters in this instance by padding them with spaces on the left, for a specified total length.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.padleft?view=netframework-4.7#System_String_PadLeft_System_Int32_System_Char_" data-linktype="relative-path">Pad​Left(​Int32, ​Char)</a></span> </td> <td> <p>Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a specified total length.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.padright?view=netframework-4.7#System_String_PadRight_System_Int32_" data-linktype="relative-path">Pad​Right(​Int32)</a></span> </td> <td> <p>Returns a new string that left-aligns the characters in this string by padding them with spaces on the right, for a specified total length.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.padright?view=netframework-4.7#System_String_PadRight_System_Int32_System_Char_" data-linktype="relative-path">Pad​Right(​Int32, ​Char)</a></span> </td> <td> <p>Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.remove?view=netframework-4.7#System_String_Remove_System_Int32_" data-linktype="relative-path">Remove(​Int32)</a></span> </td> <td> <p>Returns a new string in which all the characters in the current instance, beginning at a specified position and continuing through the last position, have been deleted.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.remove?view=netframework-4.7#System_String_Remove_System_Int32_System_Int32_" data-linktype="relative-path">Remove(​Int32, ​Int32)</a></span> </td> <td> <p>Returns a new string in which a specified number of characters in the current instance beginning at a specified position have been deleted.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.replace?view=netframework-4.7#System_String_Replace_System_Char_System_Char_" data-linktype="relative-path">Replace(​Char, ​Char)</a></span> </td> <td> <p>Returns a new string in which all occurrences of a specified Unicode character in this instance are replaced with another specified Unicode character.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.replace?view=netframework-4.7#System_String_Replace_System_String_System_String_" data-linktype="relative-path">Replace(​String, ​String)</a></span> </td> <td> <p>Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.replace?view=netframework-4.7#System_String_Replace_System_String_System_String_System_StringComparison_" data-linktype="relative-path">Replace(​String, ​String, ​String​Comparison)</a></span> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.replace?view=netframework-4.7#System_String_Replace_System_String_System_String_System_Boolean_System_Globalization_CultureInfo_" data-linktype="relative-path">Replace(​String, ​String, ​Boolean, ​Culture​Info)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_String___System_Int32_System_StringSplitOptions_" data-linktype="relative-path">Split(​String[], ​Int32, ​String​Split​Options)</a></span> </td> <td> <p>Splits a string into a maximum number of substrings based on the strings in an array. You can specify whether the substrings include empty array elements.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_String_System_Int32_System_StringSplitOptions_" data-linktype="relative-path">Split(​String, ​Int32, ​String​Split​Options)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_Char___System_Int32_System_StringSplitOptions_" data-linktype="relative-path">Split(​Char[], ​Int32, ​String​Split​Options)</a></span> </td> <td> <p>Splits a string into a maximum number of substrings based on the characters in an array.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_Char_System_Int32_System_StringSplitOptions_" data-linktype="relative-path">Split(​Char, ​Int32, ​String​Split​Options)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_String___System_StringSplitOptions_" data-linktype="relative-path">Split(​String[], ​String​Split​Options)</a></span> </td> <td> <p>Splits a string into substrings based on the strings in an array. You can specify whether the substrings include empty array elements.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_Char_System_StringSplitOptions_" data-linktype="relative-path">Split(​Char, ​String​Split​Options)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_Char___System_StringSplitOptions_" data-linktype="relative-path">Split(​Char[], ​String​Split​Options)</a></span> </td> <td> <p>Splits a string into substrings based on the characters in an array. You can specify whether the substrings include empty array elements.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_Char___System_Int32_" data-linktype="relative-path">Split(​Char[], ​Int32)</a></span> </td> <td> <p>Splits a string into a maximum number of substrings based on the characters in an array. You also specify the maximum number of substrings to return.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_String_System_StringSplitOptions_" data-linktype="relative-path">Split(​String, ​String​Split​Options)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.split?view=netframework-4.7#System_String_Split_System_Char___" data-linktype="relative-path">Split(​Char[])</a></span> </td> <td> <p>Splits a string into substrings that are based on the characters in an array.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.startswith?view=netframework-4.7#System_String_StartsWith_System_String_System_Boolean_System_Globalization_CultureInfo_" data-linktype="relative-path">Starts​With(​String, ​Boolean, ​Culture​Info)</a></span> </td> <td> <p>Determines whether the beginning of this string instance matches the specified string when compared using the specified culture.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.startswith?view=netframework-4.7#System_String_StartsWith_System_String_System_StringComparison_" data-linktype="relative-path">Starts​With(​String, ​String​Comparison)</a></span> </td> <td> <p>Determines whether the beginning of this string instance matches the specified string when compared using the specified comparison option.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.startswith?view=netframework-4.7#System_String_StartsWith_System_String_" data-linktype="relative-path">Starts​With(​String)</a></span> </td> <td> <p>Determines whether the beginning of this string instance matches the specified string.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.startswith?view=netframework-4.7#System_String_StartsWith_System_Char_" data-linktype="relative-path">Starts​With(​Char)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.substring?view=netframework-4.7#System_String_Substring_System_Int32_" data-linktype="relative-path">Substring(​Int32)</a></span> </td> <td> <p>Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.substring?view=netframework-4.7#System_String_Substring_System_Int32_System_Int32_" data-linktype="relative-path">Substring(​Int32, ​Int32)</a></span> </td> <td> <p>Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.tochararray?view=netframework-4.7#System_String_ToCharArray_System_Int32_System_Int32_" data-linktype="relative-path">To​Char​Array(​Int32, ​Int32)</a></span> </td> <td> <p>Copies the characters in a specified substring in this instance to a Unicode character array.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.tochararray?view=netframework-4.7#System_String_ToCharArray" data-linktype="relative-path">To​Char​Array()</a></span> </td> <td> <p>Copies the characters in this instance to a Unicode character array.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.tolower?view=netframework-4.7#System_String_ToLower" data-linktype="relative-path">To​Lower()</a></span> </td> <td> <p>Returns a copy of this string converted to lowercase.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.tolower?view=netframework-4.7#System_String_ToLower_System_Globalization_CultureInfo_" data-linktype="relative-path">To​Lower(​Culture​Info)</a></span> </td> <td> <p>Returns a copy of this string converted to lowercase, using the casing rules of the specified culture.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.tolowerinvariant?view=netframework-4.7#System_String_ToLowerInvariant" data-linktype="relative-path">To​Lower​Invariant()</a></span> </td> <td> <p>Returns a copy of this <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object converted to lowercase using the casing rules of the invariant culture.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.tostring?view=netframework-4.7#System_String_ToString" data-linktype="relative-path">To​String()</a></span> </td> <td> <p>Returns this instance of <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>; no actual conversion is performed.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.tostring?view=netframework-4.7#System_String_ToString_System_IFormatProvider_" data-linktype="relative-path">To​String(​IFormat​Provider)</a></span> </td> <td> <p>Returns this instance of <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a>; no actual conversion is performed.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.toupper?view=netframework-4.7#System_String_ToUpper" data-linktype="relative-path">To​Upper()</a></span> </td> <td> <p>Returns a copy of this string converted to uppercase.</p> </td> </tr> <tr data-moniker=" netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.toupper?view=netframework-4.7#System_String_ToUpper_System_Globalization_CultureInfo_" data-linktype="relative-path">To​Upper(​Culture​Info)</a></span> </td> <td> <p>Returns a copy of this string converted to uppercase, using the casing rules of the specified culture.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.toupperinvariant?view=netframework-4.7#System_String_ToUpperInvariant" data-linktype="relative-path">To​Upper​Invariant()</a></span> </td> <td> <p>Returns a copy of this <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object converted to uppercase using the casing rules of the invariant culture.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.trim?view=netframework-4.7#System_String_Trim_System_Char_" data-linktype="relative-path">Trim(​Char)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.trim?view=netframework-4.7#System_String_Trim_System_Char___" data-linktype="relative-path">Trim(​Char[])</a></span> </td> <td> <p>Removes all leading and trailing occurrences of a set of characters specified in an array from the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.trim?view=netframework-4.7#System_String_Trim" data-linktype="relative-path">Trim()</a></span> </td> <td> <p>Removes all leading and trailing white-space characters from the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.trimend?view=netframework-4.7#System_String_TrimEnd" data-linktype="relative-path">Trim​End()</a></span> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.trimend?view=netframework-4.7#System_String_TrimEnd_System_Char_" data-linktype="relative-path">Trim​End(​Char)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.trimend?view=netframework-4.7#System_String_TrimEnd_System_Char___" data-linktype="relative-path">Trim​End(​Char[])</a></span> </td> <td> <p>Removes all trailing occurrences of a set of characters specified in an array from the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object.</p> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.trimstart?view=netframework-4.7#System_String_TrimStart" data-linktype="relative-path">Trim​Start()</a></span> </td> </tr> <tr data-moniker=" netcore-2.0 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.trimstart?view=netframework-4.7#System_String_TrimStart_System_Char_" data-linktype="relative-path">Trim​Start(​Char)</a></span> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.trimstart?view=netframework-4.7#System_String_TrimStart_System_Char___" data-linktype="relative-path">Trim​Start(​Char[])</a></span> </td> <td> <p>Removes all leading occurrences of a set of characters specified in an array from the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object.</p> </td> </tr> </table> <h2 class="accented ">Operators </h2> <table class="nameValue"> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.op_equality?view=netframework-4.7#System_String_op_Equality_System_String_System_String_" data-linktype="relative-path">Equality(​String, ​String)</a></span> </td> <td> <p>Determines whether two specified strings have the same value.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.op_inequality?view=netframework-4.7#System_String_op_Inequality_System_String_System_String_" data-linktype="relative-path">Inequality(​String, ​String)</a></span> </td> <td> <p>Determines whether two specified strings have different values.</p> </td> </tr> </table> <h2 class="accented ">Explicit Interface Implementations </h2> <table class="nameValue"> <tr data-moniker=" xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-collections-generic-ienumerable-system-char--getenumerator?view=netframework-4.7#System_String_System_Collections_Generic_IEnumerable_System_Char__GetEnumerator" data-linktype="relative-path">I​Enumerable<​Char>.​Get​Enumerator()</a></span> </td> <td> <p>Returns an enumerator that iterates through the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object.</p> </td> </tr> <tr> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-collections-ienumerable-getenumerator?view=netframework-4.7#System_String_System_Collections_IEnumerable_GetEnumerator" data-linktype="relative-path">I​Enumerable.​Get​Enumerator()</a></span> </td> <td> <p>Returns an enumerator that iterates through the current <a class="xref" href="system.string?view=netframework-4.7" data-linktype="relative-path">String</a> object.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netstandard-1.0 netstandard-1.1 netstandard-1.2 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.system-icomparable-compareto?view=netframework-4.7#System_String_System_IComparable_CompareTo_System_Object_" data-linktype="relative-path">I​Comparable.​Compare​To(​Object)</a></span> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-gettypecode?view=netframework-4.7#System_String_System_IConvertible_GetTypeCode" data-linktype="relative-path">I​Convertible.​Get​Type​Code()</a></span> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-toboolean?view=netframework-4.7#System_String_System_IConvertible_ToBoolean_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Boolean(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.toboolean?view=netframework-4.7#System_IConvertible_ToBoolean_System_IFormatProvider_" data-linktype="relative-path">ToBoolean(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-tobyte?view=netframework-4.7#System_String_System_IConvertible_ToByte_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Byte(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.tobyte?view=netframework-4.7#System_IConvertible_ToByte_System_IFormatProvider_" data-linktype="relative-path">ToByte(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-tochar?view=netframework-4.7#System_String_System_IConvertible_ToChar_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Char(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.tochar?view=netframework-4.7#System_IConvertible_ToChar_System_IFormatProvider_" data-linktype="relative-path">ToChar(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-todatetime?view=netframework-4.7#System_String_System_IConvertible_ToDateTime_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Date​Time(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.todatetime?view=netframework-4.7#System_IConvertible_ToDateTime_System_IFormatProvider_" data-linktype="relative-path">ToDateTime(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-todecimal?view=netframework-4.7#System_String_System_IConvertible_ToDecimal_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Decimal(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.todecimal?view=netframework-4.7#System_IConvertible_ToDecimal_System_IFormatProvider_" data-linktype="relative-path">ToDecimal(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-todouble?view=netframework-4.7#System_String_System_IConvertible_ToDouble_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Double(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.todouble?view=netframework-4.7#System_IConvertible_ToDouble_System_IFormatProvider_" data-linktype="relative-path">ToDouble(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-toint16?view=netframework-4.7#System_String_System_IConvertible_ToInt16_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Int16(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.toint16?view=netframework-4.7#System_IConvertible_ToInt16_System_IFormatProvider_" data-linktype="relative-path">ToInt16(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-toint32?view=netframework-4.7#System_String_System_IConvertible_ToInt32_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Int32(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.toint32?view=netframework-4.7#System_IConvertible_ToInt32_System_IFormatProvider_" data-linktype="relative-path">ToInt32(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-toint64?view=netframework-4.7#System_String_System_IConvertible_ToInt64_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Int64(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.toint64?view=netframework-4.7#System_IConvertible_ToInt64_System_IFormatProvider_" data-linktype="relative-path">ToInt64(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-tosbyte?view=netframework-4.7#System_String_System_IConvertible_ToSByte_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​SByte(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.tosbyte?view=netframework-4.7#System_IConvertible_ToSByte_System_IFormatProvider_" data-linktype="relative-path">ToSByte(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-tosingle?view=netframework-4.7#System_String_System_IConvertible_ToSingle_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Single(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.tosingle?view=netframework-4.7#System_IConvertible_ToSingle_System_IFormatProvider_" data-linktype="relative-path">ToSingle(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 "> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-tostring?view=netframework-4.7#System_String_System_IConvertible_ToString_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​String(​IFormat​Provider)</a></span> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-totype?view=netframework-4.7#System_String_System_IConvertible_ToType_System_Type_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​Type(​Type, ​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.totype?view=netframework-4.7#System_IConvertible_ToType_System_Type_System_IFormatProvider_" data-linktype="relative-path">ToType(Type, IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-touint16?view=netframework-4.7#System_String_System_IConvertible_ToUInt16_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​UInt16(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.touint16?view=netframework-4.7#System_IConvertible_ToUInt16_System_IFormatProvider_" data-linktype="relative-path">ToUInt16(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-touint32?view=netframework-4.7#System_String_System_IConvertible_ToUInt32_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​UInt32(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.touint32?view=netframework-4.7#System_IConvertible_ToUInt32_System_IFormatProvider_" data-linktype="relative-path">ToUInt32(IFormatProvider)</a>.</p> </td> </tr> <tr data-moniker=" netcore-1.0 netcore-1.1 netcore-2.0 netframework-4.5.1 netframework-4.5.2 netframework-4.5 netframework-4.6.1 netframework-4.6.2 netframework-4.6 netframework-4.7 netstandard-1.3 netstandard-1.4 netstandard-1.5 netstandard-1.6 netstandard-2.0 xamarinandroid-7.1 xamarinios-10.8 xamarinmac-3.0 "> <td> <span class="lang-csharp"><a class="xref" href="system.string.system-iconvertible-touint64?view=netframework-4.7#System_String_System_IConvertible_ToUInt64_System_IFormatProvider_" data-linktype="relative-path">I​Convertible.​To​UInt64(​IFormat​Provider)</a></span> </td> <td> <p>For a description of this member, see <a class="xref" href="system.iconvertible.touint64?view=netframework-4.7#System_IConvertible_ToUInt64_System_IFormatProvider_" data-linktype="relative-path">ToUInt64(IFormatProvider)</a>.</p> </td> </tr> </table> <h2 class="accented">Extension Methods</h2> <table class="nameValue"> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablearray.toimmutablearray?view=netframework-4.7#System_Collections_Immutable_ImmutableArray_ToImmutableArray__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">ToImmutableArray<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutabledictionary.toimmutabledictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableDictionary_ToImmutableDictionary__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-linktype="relative-path">ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutabledictionary.toimmutabledictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableDictionary_ToImmutableDictionary__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutabledictionary.toimmutabledictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableDictionary_ToImmutableDictionary__2_System_Collections_Generic_IEnumerable_System_Collections_Generic_KeyValuePair___0___1___" data-linktype="relative-path">ToImmutableDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutabledictionary.toimmutabledictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableDictionary_ToImmutableDictionary__2_System_Collections_Generic_IEnumerable_System_Collections_Generic_KeyValuePair___0___1___System_Collections_Generic_IEqualityComparer___0__" data-linktype="relative-path">ToImmutableDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutabledictionary.toimmutabledictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableDictionary_ToImmutableDictionary__2_System_Collections_Generic_IEnumerable_System_Collections_Generic_KeyValuePair___0___1___System_Collections_Generic_IEqualityComparer___0__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">ToImmutableDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutabledictionary.toimmutabledictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableDictionary_ToImmutableDictionary__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__" data-linktype="relative-path">ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutabledictionary.toimmutabledictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableDictionary_ToImmutableDictionary__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutabledictionary.toimmutabledictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableDictionary_ToImmutableDictionary__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__System_Collections_Generic_IEqualityComparer___1__System_Collections_Generic_IEqualityComparer___2__" data-linktype="relative-path">ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablehashset.toimmutablehashset?view=netframework-4.7#System_Collections_Immutable_ImmutableHashSet_ToImmutableHashSet__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">ToImmutableHashSet<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablehashset.toimmutablehashset?view=netframework-4.7#System_Collections_Immutable_ImmutableHashSet_ToImmutableHashSet__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEqualityComparer___0__" data-linktype="relative-path">ToImmutableHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablelist.toimmutablelist?view=netframework-4.7#System_Collections_Immutable_ImmutableList_ToImmutableList__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">ToImmutableList<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablesorteddictionary.toimmutablesorteddictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableSortedDictionary_ToImmutableSortedDictionary__2_System_Collections_Generic_IEnumerable_System_Collections_Generic_KeyValuePair___0___1___" data-linktype="relative-path">ToImmutableSortedDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablesorteddictionary.toimmutablesorteddictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableSortedDictionary_ToImmutableSortedDictionary__2_System_Collections_Generic_IEnumerable_System_Collections_Generic_KeyValuePair___0___1___System_Collections_Generic_IComparer___0__" data-linktype="relative-path">ToImmutableSortedDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablesorteddictionary.toimmutablesorteddictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableSortedDictionary_ToImmutableSortedDictionary__2_System_Collections_Generic_IEnumerable_System_Collections_Generic_KeyValuePair___0___1___System_Collections_Generic_IComparer___0__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">ToImmutableSortedDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IComparer<TKey>, IEqualityComparer<TValue>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablesorteddictionary.toimmutablesorteddictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableSortedDictionary_ToImmutableSortedDictionary__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__" data-linktype="relative-path">ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablesorteddictionary.toimmutablesorteddictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableSortedDictionary_ToImmutableSortedDictionary__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__System_Collections_Generic_IComparer___1__" data-linktype="relative-path">ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablesorteddictionary.toimmutablesorteddictionary?view=netframework-4.7#System_Collections_Immutable_ImmutableSortedDictionary_ToImmutableSortedDictionary__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__System_Collections_Generic_IComparer___1__System_Collections_Generic_IEqualityComparer___2__" data-linktype="relative-path">ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>, IEqualityComparer<TValue>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablesortedset.toimmutablesortedset?view=netframework-4.7#System_Collections_Immutable_ImmutableSortedSet_ToImmutableSortedSet__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">ToImmutableSortedSet<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.collections.immutable.immutablesortedset.toimmutablesortedset?view=netframework-4.7#System_Collections_Immutable_ImmutableSortedSet_ToImmutableSortedSet__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IComparer___0__" data-linktype="relative-path">ToImmutableSortedSet<TSource>(IEnumerable<TSource>, IComparer<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.data.datatableextensions.copytodatatable?view=netframework-4.7#System_Data_DataTableExtensions_CopyToDataTable__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">CopyToDataTable<T>(IEnumerable<T>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.data.datatableextensions.copytodatatable?view=netframework-4.7#System_Data_DataTableExtensions_CopyToDataTable__1_System_Collections_Generic_IEnumerable___0__System_Data_DataTable_System_Data_LoadOption_" data-linktype="relative-path">CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.data.datatableextensions.copytodatatable?view=netframework-4.7#System_Data_DataTableExtensions_CopyToDataTable__1_System_Collections_Generic_IEnumerable___0__System_Data_DataTable_System_Data_LoadOption_System_Data_FillErrorEventHandler_" data-linktype="relative-path">CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.aggregate?view=netframework-4.7#System_Linq_Enumerable_Aggregate__1_System_Collections_Generic_IEnumerable___0__System_Func___0___0___0__" data-linktype="relative-path">Aggregate<TSource>(IEnumerable<TSource>, Func<TSource,TSource,TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.aggregate?view=netframework-4.7#System_Linq_Enumerable_Aggregate__2_System_Collections_Generic_IEnumerable___0____1_System_Func___1___0___1__" data-linktype="relative-path">Aggregate<TSource,TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.aggregate?view=netframework-4.7#System_Linq_Enumerable_Aggregate__3_System_Collections_Generic_IEnumerable___0____1_System_Func___1___0___1__System_Func___1___2__" data-linktype="relative-path">Aggregate<TSource,TAccumulate,TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, Func<TAccumulate,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.all?view=netframework-4.7#System_Linq_Enumerable_All__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">All<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.any?view=netframework-4.7#System_Linq_Enumerable_Any__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Any<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.any?view=netframework-4.7#System_Linq_Enumerable_Any__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">Any<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.append?view=netframework-4.7#System_Linq_Enumerable_Append__1_System_Collections_Generic_IEnumerable___0____0_" data-linktype="relative-path">Append<TSource>(IEnumerable<TSource>, TSource)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.asenumerable?view=netframework-4.7#System_Linq_Enumerable_AsEnumerable__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">AsEnumerable<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Decimal__" data-linktype="relative-path">Average(IEnumerable<Decimal>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Double__" data-linktype="relative-path">Average(IEnumerable<Double>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Int32__" data-linktype="relative-path">Average(IEnumerable<Int32>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Int64__" data-linktype="relative-path">Average(IEnumerable<Int64>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Nullable_System_Decimal___" data-linktype="relative-path">Average(IEnumerable<Nullable<Decimal>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Nullable_System_Double___" data-linktype="relative-path">Average(IEnumerable<Nullable<Double>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Nullable_System_Int32___" data-linktype="relative-path">Average(IEnumerable<Nullable<Int32>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Nullable_System_Int64___" data-linktype="relative-path">Average(IEnumerable<Nullable<Int64>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Nullable_System_Single___" data-linktype="relative-path">Average(IEnumerable<Nullable<Single>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average_System_Collections_Generic_IEnumerable_System_Single__" data-linktype="relative-path">Average(IEnumerable<Single>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Decimal__" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Double__" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Double>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32__" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int64__" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Decimal___" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Double___" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int32___" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int64___" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Single___" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.average?view=netframework-4.7#System_Linq_Enumerable_Average__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Single__" data-linktype="relative-path">Average<TSource>(IEnumerable<TSource>, Func<TSource,Single>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.cast?view=netframework-4.7#System_Linq_Enumerable_Cast__1_System_Collections_IEnumerable_" data-linktype="relative-path">Cast<TResult>(IEnumerable)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.concat?view=netframework-4.7#System_Linq_Enumerable_Concat__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Concat<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.contains?view=netframework-4.7#System_Linq_Enumerable_Contains__1_System_Collections_Generic_IEnumerable___0____0_" data-linktype="relative-path">Contains<TSource>(IEnumerable<TSource>, TSource)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.contains?view=netframework-4.7#System_Linq_Enumerable_Contains__1_System_Collections_Generic_IEnumerable___0____0_System_Collections_Generic_IEqualityComparer___0__" data-linktype="relative-path">Contains<TSource>(IEnumerable<TSource>, TSource, IEqualityComparer<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.count?view=netframework-4.7#System_Linq_Enumerable_Count__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Count<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.count?view=netframework-4.7#System_Linq_Enumerable_Count__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">Count<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.defaultifempty?view=netframework-4.7#System_Linq_Enumerable_DefaultIfEmpty__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">DefaultIfEmpty<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.defaultifempty?view=netframework-4.7#System_Linq_Enumerable_DefaultIfEmpty__1_System_Collections_Generic_IEnumerable___0____0_" data-linktype="relative-path">DefaultIfEmpty<TSource>(IEnumerable<TSource>, TSource)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.distinct?view=netframework-4.7#System_Linq_Enumerable_Distinct__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Distinct<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.distinct?view=netframework-4.7#System_Linq_Enumerable_Distinct__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEqualityComparer___0__" data-linktype="relative-path">Distinct<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.elementat?view=netframework-4.7#System_Linq_Enumerable_ElementAt__1_System_Collections_Generic_IEnumerable___0__System_Int32_" data-linktype="relative-path">ElementAt<TSource>(IEnumerable<TSource>, Int32)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.elementatordefault?view=netframework-4.7#System_Linq_Enumerable_ElementAtOrDefault__1_System_Collections_Generic_IEnumerable___0__System_Int32_" data-linktype="relative-path">ElementAtOrDefault<TSource>(IEnumerable<TSource>, Int32)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.except?view=netframework-4.7#System_Linq_Enumerable_Except__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Except<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.except?view=netframework-4.7#System_Linq_Enumerable_Except__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEqualityComparer___0__" data-linktype="relative-path">Except<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.first?view=netframework-4.7#System_Linq_Enumerable_First__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">First<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.first?view=netframework-4.7#System_Linq_Enumerable_First__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">First<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.firstordefault?view=netframework-4.7#System_Linq_Enumerable_FirstOrDefault__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">FirstOrDefault<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.firstordefault?view=netframework-4.7#System_Linq_Enumerable_FirstOrDefault__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">FirstOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupby?view=netframework-4.7#System_Linq_Enumerable_GroupBy__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-linktype="relative-path">GroupBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupby?view=netframework-4.7#System_Linq_Enumerable_GroupBy__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">GroupBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupby?view=netframework-4.7#System_Linq_Enumerable_GroupBy__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__" data-linktype="relative-path">GroupBy<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupby?view=netframework-4.7#System_Linq_Enumerable_GroupBy__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">GroupBy<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupby?view=netframework-4.7#System_Linq_Enumerable_GroupBy__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___1_System_Collections_Generic_IEnumerable___0____2__" data-linktype="relative-path">GroupBy<TSource,TKey,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupby?view=netframework-4.7#System_Linq_Enumerable_GroupBy__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___1_System_Collections_Generic_IEnumerable___0____2__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">GroupBy<TSource,TKey,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupby?view=netframework-4.7#System_Linq_Enumerable_GroupBy__4_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__System_Func___1_System_Collections_Generic_IEnumerable___2____3__" data-linktype="relative-path">GroupBy<TSource,TKey,TElement,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupby?view=netframework-4.7#System_Linq_Enumerable_GroupBy__4_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__System_Func___1_System_Collections_Generic_IEnumerable___2____3__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">GroupBy<TSource,TKey,TElement,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>,TResult>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupjoin?view=netframework-4.7#System_Linq_Enumerable_GroupJoin__4_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___1__System_Func___0___2__System_Func___1___2__System_Func___0_System_Collections_Generic_IEnumerable___1____3__" data-linktype="relative-path">GroupJoin<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,IEnumerable<TInner>,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.groupjoin?view=netframework-4.7#System_Linq_Enumerable_GroupJoin__4_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___1__System_Func___0___2__System_Func___1___2__System_Func___0_System_Collections_Generic_IEnumerable___1____3__System_Collections_Generic_IEqualityComparer___2__" data-linktype="relative-path">GroupJoin<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,IEnumerable<TInner>,TResult>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.intersect?view=netframework-4.7#System_Linq_Enumerable_Intersect__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Intersect<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.intersect?view=netframework-4.7#System_Linq_Enumerable_Intersect__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEqualityComparer___0__" data-linktype="relative-path">Intersect<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.join?view=netframework-4.7#System_Linq_Enumerable_Join__4_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___1__System_Func___0___2__System_Func___1___2__System_Func___0___1___3__" data-linktype="relative-path">Join<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,TInner,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.join?view=netframework-4.7#System_Linq_Enumerable_Join__4_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___1__System_Func___0___2__System_Func___1___2__System_Func___0___1___3__System_Collections_Generic_IEqualityComparer___2__" data-linktype="relative-path">Join<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,TInner,TResult>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.last?view=netframework-4.7#System_Linq_Enumerable_Last__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Last<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.last?view=netframework-4.7#System_Linq_Enumerable_Last__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">Last<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.lastordefault?view=netframework-4.7#System_Linq_Enumerable_LastOrDefault__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">LastOrDefault<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.lastordefault?view=netframework-4.7#System_Linq_Enumerable_LastOrDefault__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">LastOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.longcount?view=netframework-4.7#System_Linq_Enumerable_LongCount__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">LongCount<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.longcount?view=netframework-4.7#System_Linq_Enumerable_LongCount__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">LongCount<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Decimal__" data-linktype="relative-path">Max(IEnumerable<Decimal>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Double__" data-linktype="relative-path">Max(IEnumerable<Double>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Int32__" data-linktype="relative-path">Max(IEnumerable<Int32>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Int64__" data-linktype="relative-path">Max(IEnumerable<Int64>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Nullable_System_Decimal___" data-linktype="relative-path">Max(IEnumerable<Nullable<Decimal>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Nullable_System_Double___" data-linktype="relative-path">Max(IEnumerable<Nullable<Double>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Nullable_System_Int32___" data-linktype="relative-path">Max(IEnumerable<Nullable<Int32>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Nullable_System_Int64___" data-linktype="relative-path">Max(IEnumerable<Nullable<Int64>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Nullable_System_Single___" data-linktype="relative-path">Max(IEnumerable<Nullable<Single>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max_System_Collections_Generic_IEnumerable_System_Single__" data-linktype="relative-path">Max(IEnumerable<Single>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Decimal__" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Double__" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Double>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32__" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int64__" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Decimal___" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Double___" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int32___" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int64___" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Single___" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Single__" data-linktype="relative-path">Max<TSource>(IEnumerable<TSource>, Func<TSource,Single>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.max?view=netframework-4.7#System_Linq_Enumerable_Max__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-linktype="relative-path">Max<TSource,TResult>(IEnumerable<TSource>, Func<TSource,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Decimal__" data-linktype="relative-path">Min(IEnumerable<Decimal>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Double__" data-linktype="relative-path">Min(IEnumerable<Double>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Int32__" data-linktype="relative-path">Min(IEnumerable<Int32>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Int64__" data-linktype="relative-path">Min(IEnumerable<Int64>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Nullable_System_Decimal___" data-linktype="relative-path">Min(IEnumerable<Nullable<Decimal>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Nullable_System_Double___" data-linktype="relative-path">Min(IEnumerable<Nullable<Double>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Nullable_System_Int32___" data-linktype="relative-path">Min(IEnumerable<Nullable<Int32>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Nullable_System_Int64___" data-linktype="relative-path">Min(IEnumerable<Nullable<Int64>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Nullable_System_Single___" data-linktype="relative-path">Min(IEnumerable<Nullable<Single>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min_System_Collections_Generic_IEnumerable_System_Single__" data-linktype="relative-path">Min(IEnumerable<Single>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Decimal__" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Double__" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Double>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32__" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int64__" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Decimal___" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Double___" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int32___" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int64___" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Single___" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Single__" data-linktype="relative-path">Min<TSource>(IEnumerable<TSource>, Func<TSource,Single>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.min?view=netframework-4.7#System_Linq_Enumerable_Min__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-linktype="relative-path">Min<TSource,TResult>(IEnumerable<TSource>, Func<TSource,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.oftype?view=netframework-4.7#System_Linq_Enumerable_OfType__1_System_Collections_IEnumerable_" data-linktype="relative-path">OfType<TResult>(IEnumerable)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.orderby?view=netframework-4.7#System_Linq_Enumerable_OrderBy__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-linktype="relative-path">OrderBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.orderby?view=netframework-4.7#System_Linq_Enumerable_OrderBy__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Collections_Generic_IComparer___1__" data-linktype="relative-path">OrderBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.orderbydescending?view=netframework-4.7#System_Linq_Enumerable_OrderByDescending__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-linktype="relative-path">OrderByDescending<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.orderbydescending?view=netframework-4.7#System_Linq_Enumerable_OrderByDescending__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Collections_Generic_IComparer___1__" data-linktype="relative-path">OrderByDescending<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.prepend?view=netframework-4.7#System_Linq_Enumerable_Prepend__1_System_Collections_Generic_IEnumerable___0____0_" data-linktype="relative-path">Prepend<TSource>(IEnumerable<TSource>, TSource)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.reverse?view=netframework-4.7#System_Linq_Enumerable_Reverse__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Reverse<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.select?view=netframework-4.7#System_Linq_Enumerable_Select__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-linktype="relative-path">Select<TSource,TResult>(IEnumerable<TSource>, Func<TSource,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.select?view=netframework-4.7#System_Linq_Enumerable_Select__2_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32___1__" data-linktype="relative-path">Select<TSource,TResult>(IEnumerable<TSource>, Func<TSource,Int32,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.selectmany?view=netframework-4.7#System_Linq_Enumerable_SelectMany__2_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Collections_Generic_IEnumerable___1___" data-linktype="relative-path">SelectMany<TSource,TResult>(IEnumerable<TSource>, Func<TSource,IEnumerable<TResult>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.selectmany?view=netframework-4.7#System_Linq_Enumerable_SelectMany__2_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32_System_Collections_Generic_IEnumerable___1___" data-linktype="relative-path">SelectMany<TSource,TResult>(IEnumerable<TSource>, Func<TSource,Int32,IEnumerable<TResult>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.selectmany?view=netframework-4.7#System_Linq_Enumerable_SelectMany__3_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Collections_Generic_IEnumerable___1___System_Func___0___1___2__" data-linktype="relative-path">SelectMany<TSource,TCollection,TResult>(IEnumerable<TSource>, Func<TSource,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.selectmany?view=netframework-4.7#System_Linq_Enumerable_SelectMany__3_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32_System_Collections_Generic_IEnumerable___1___System_Func___0___1___2__" data-linktype="relative-path">SelectMany<TSource,TCollection,TResult>(IEnumerable<TSource>, Func<TSource,Int32,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sequenceequal?view=netframework-4.7#System_Linq_Enumerable_SequenceEqual__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">SequenceEqual<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sequenceequal?view=netframework-4.7#System_Linq_Enumerable_SequenceEqual__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEqualityComparer___0__" data-linktype="relative-path">SequenceEqual<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.single?view=netframework-4.7#System_Linq_Enumerable_Single__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Single<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.single?view=netframework-4.7#System_Linq_Enumerable_Single__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">Single<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.singleordefault?view=netframework-4.7#System_Linq_Enumerable_SingleOrDefault__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">SingleOrDefault<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.singleordefault?view=netframework-4.7#System_Linq_Enumerable_SingleOrDefault__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">SingleOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.skip?view=netframework-4.7#System_Linq_Enumerable_Skip__1_System_Collections_Generic_IEnumerable___0__System_Int32_" data-linktype="relative-path">Skip<TSource>(IEnumerable<TSource>, Int32)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.skiplast?view=netframework-4.7#System_Linq_Enumerable_SkipLast__1_System_Collections_Generic_IEnumerable___0__System_Int32_" data-linktype="relative-path">SkipLast<TSource>(IEnumerable<TSource>, Int32)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.skipwhile?view=netframework-4.7#System_Linq_Enumerable_SkipWhile__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">SkipWhile<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.skipwhile?view=netframework-4.7#System_Linq_Enumerable_SkipWhile__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32_System_Boolean__" data-linktype="relative-path">SkipWhile<TSource>(IEnumerable<TSource>, Func<TSource,Int32,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Decimal__" data-linktype="relative-path">Sum(IEnumerable<Decimal>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Double__" data-linktype="relative-path">Sum(IEnumerable<Double>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Int32__" data-linktype="relative-path">Sum(IEnumerable<Int32>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Int64__" data-linktype="relative-path">Sum(IEnumerable<Int64>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Nullable_System_Decimal___" data-linktype="relative-path">Sum(IEnumerable<Nullable<Decimal>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Nullable_System_Double___" data-linktype="relative-path">Sum(IEnumerable<Nullable<Double>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Nullable_System_Int32___" data-linktype="relative-path">Sum(IEnumerable<Nullable<Int32>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Nullable_System_Int64___" data-linktype="relative-path">Sum(IEnumerable<Nullable<Int64>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Nullable_System_Single___" data-linktype="relative-path">Sum(IEnumerable<Nullable<Single>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum_System_Collections_Generic_IEnumerable_System_Single__" data-linktype="relative-path">Sum(IEnumerable<Single>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Decimal__" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Double__" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Double>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32__" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int64__" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Decimal___" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Double___" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int32___" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int64___" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Single___" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.sum?view=netframework-4.7#System_Linq_Enumerable_Sum__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Single__" data-linktype="relative-path">Sum<TSource>(IEnumerable<TSource>, Func<TSource,Single>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.take?view=netframework-4.7#System_Linq_Enumerable_Take__1_System_Collections_Generic_IEnumerable___0__System_Int32_" data-linktype="relative-path">Take<TSource>(IEnumerable<TSource>, Int32)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.takelast?view=netframework-4.7#System_Linq_Enumerable_TakeLast__1_System_Collections_Generic_IEnumerable___0__System_Int32_" data-linktype="relative-path">TakeLast<TSource>(IEnumerable<TSource>, Int32)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.takewhile?view=netframework-4.7#System_Linq_Enumerable_TakeWhile__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">TakeWhile<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.takewhile?view=netframework-4.7#System_Linq_Enumerable_TakeWhile__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32_System_Boolean__" data-linktype="relative-path">TakeWhile<TSource>(IEnumerable<TSource>, Func<TSource,Int32,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.toarray?view=netframework-4.7#System_Linq_Enumerable_ToArray__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">ToArray<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.todictionary?view=netframework-4.7#System_Linq_Enumerable_ToDictionary__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-linktype="relative-path">ToDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.todictionary?view=netframework-4.7#System_Linq_Enumerable_ToDictionary__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">ToDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.todictionary?view=netframework-4.7#System_Linq_Enumerable_ToDictionary__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__" data-linktype="relative-path">ToDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.todictionary?view=netframework-4.7#System_Linq_Enumerable_ToDictionary__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">ToDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.tohashset?view=netframework-4.7#System_Linq_Enumerable_ToHashSet__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">ToHashSet<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.tohashset?view=netframework-4.7#System_Linq_Enumerable_ToHashSet__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEqualityComparer___0__" data-linktype="relative-path">ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.tolist?view=netframework-4.7#System_Linq_Enumerable_ToList__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">ToList<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.tolookup?view=netframework-4.7#System_Linq_Enumerable_ToLookup__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-linktype="relative-path">ToLookup<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.tolookup?view=netframework-4.7#System_Linq_Enumerable_ToLookup__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">ToLookup<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.tolookup?view=netframework-4.7#System_Linq_Enumerable_ToLookup__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__" data-linktype="relative-path">ToLookup<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.tolookup?view=netframework-4.7#System_Linq_Enumerable_ToLookup__3_System_Collections_Generic_IEnumerable___0__System_Func___0___1__System_Func___0___2__System_Collections_Generic_IEqualityComparer___1__" data-linktype="relative-path">ToLookup<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.union?view=netframework-4.7#System_Linq_Enumerable_Union__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Union<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.union?view=netframework-4.7#System_Linq_Enumerable_Union__1_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEqualityComparer___0__" data-linktype="relative-path">Union<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.where?view=netframework-4.7#System_Linq_Enumerable_Where__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-linktype="relative-path">Where<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.where?view=netframework-4.7#System_Linq_Enumerable_Where__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Int32_System_Boolean__" data-linktype="relative-path">Where<TSource>(IEnumerable<TSource>, Func<TSource,Int32,Boolean>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.enumerable.zip?view=netframework-4.7#System_Linq_Enumerable_Zip__3_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___1__System_Func___0___1___2__" data-linktype="relative-path">Zip<TFirst,TSecond,TResult>(IEnumerable<TFirst>, IEnumerable<TSecond>, Func<TFirst,TSecond,TResult>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.parallelenumerable.asparallel?view=netframework-4.7#System_Linq_ParallelEnumerable_AsParallel_System_Collections_IEnumerable_" data-linktype="relative-path">AsParallel(IEnumerable)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.parallelenumerable.asparallel?view=netframework-4.7#System_Linq_ParallelEnumerable_AsParallel__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">AsParallel<TSource>(IEnumerable<TSource>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.queryable.asqueryable?view=netframework-4.7#System_Linq_Queryable_AsQueryable_System_Collections_IEnumerable_" data-linktype="relative-path">AsQueryable(IEnumerable)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.linq.queryable.asqueryable?view=netframework-4.7#System_Linq_Queryable_AsQueryable__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">AsQueryable<TElement>(IEnumerable<TElement>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.spanextensions.asspan?view=netframework-4.7#System_SpanExtensions_AsSpan_System_String_" data-linktype="relative-path">AsSpan(String)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.stringnormalizationextensions.isnormalized?view=netframework-4.7#System_StringNormalizationExtensions_IsNormalized_System_String_" data-linktype="relative-path">IsNormalized(String)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.stringnormalizationextensions.isnormalized?view=netframework-4.7#System_StringNormalizationExtensions_IsNormalized_System_String_System_Text_NormalizationForm_" data-linktype="relative-path">IsNormalized(String, NormalizationForm)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.stringnormalizationextensions.normalize?view=netframework-4.7#System_StringNormalizationExtensions_Normalize_System_String_" data-linktype="relative-path">Normalize(String)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.stringnormalizationextensions.normalize?view=netframework-4.7#System_StringNormalizationExtensions_Normalize_System_String_System_Text_NormalizationForm_" data-linktype="relative-path">Normalize(String, NormalizationForm)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.ancestors?view=netframework-4.7#System_Xml_Linq_Extensions_Ancestors__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Ancestors<T>(IEnumerable<T>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.ancestors?view=netframework-4.7#System_Xml_Linq_Extensions_Ancestors__1_System_Collections_Generic_IEnumerable___0__System_Xml_Linq_XName_" data-linktype="relative-path">Ancestors<T>(IEnumerable<T>, XName)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.ancestorsandself?view=netframework-4.7#System_Xml_Linq_Extensions_AncestorsAndSelf_System_Collections_Generic_IEnumerable_System_Xml_Linq_XElement__" data-linktype="relative-path">AncestorsAndSelf(IEnumerable<XElement>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.ancestorsandself?view=netframework-4.7#System_Xml_Linq_Extensions_AncestorsAndSelf_System_Collections_Generic_IEnumerable_System_Xml_Linq_XElement__System_Xml_Linq_XName_" data-linktype="relative-path">AncestorsAndSelf(IEnumerable<XElement>, XName)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.attributes?view=netframework-4.7#System_Xml_Linq_Extensions_Attributes_System_Collections_Generic_IEnumerable_System_Xml_Linq_XElement__" data-linktype="relative-path">Attributes(IEnumerable<XElement>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.attributes?view=netframework-4.7#System_Xml_Linq_Extensions_Attributes_System_Collections_Generic_IEnumerable_System_Xml_Linq_XElement__System_Xml_Linq_XName_" data-linktype="relative-path">Attributes(IEnumerable<XElement>, XName)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.descendantnodes?view=netframework-4.7#System_Xml_Linq_Extensions_DescendantNodes__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">DescendantNodes<T>(IEnumerable<T>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.descendantnodesandself?view=netframework-4.7#System_Xml_Linq_Extensions_DescendantNodesAndSelf_System_Collections_Generic_IEnumerable_System_Xml_Linq_XElement__" data-linktype="relative-path">DescendantNodesAndSelf(IEnumerable<XElement>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.descendants?view=netframework-4.7#System_Xml_Linq_Extensions_Descendants__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Descendants<T>(IEnumerable<T>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.descendants?view=netframework-4.7#System_Xml_Linq_Extensions_Descendants__1_System_Collections_Generic_IEnumerable___0__System_Xml_Linq_XName_" data-linktype="relative-path">Descendants<T>(IEnumerable<T>, XName)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.descendantsandself?view=netframework-4.7#System_Xml_Linq_Extensions_DescendantsAndSelf_System_Collections_Generic_IEnumerable_System_Xml_Linq_XElement__" data-linktype="relative-path">DescendantsAndSelf(IEnumerable<XElement>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.descendantsandself?view=netframework-4.7#System_Xml_Linq_Extensions_DescendantsAndSelf_System_Collections_Generic_IEnumerable_System_Xml_Linq_XElement__System_Xml_Linq_XName_" data-linktype="relative-path">DescendantsAndSelf(IEnumerable<XElement>, XName)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.elements?view=netframework-4.7#System_Xml_Linq_Extensions_Elements__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Elements<T>(IEnumerable<T>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.elements?view=netframework-4.7#System_Xml_Linq_Extensions_Elements__1_System_Collections_Generic_IEnumerable___0__System_Xml_Linq_XName_" data-linktype="relative-path">Elements<T>(IEnumerable<T>, XName)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.indocumentorder?view=netframework-4.7#System_Xml_Linq_Extensions_InDocumentOrder__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">InDocumentOrder<T>(IEnumerable<T>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.nodes?view=netframework-4.7#System_Xml_Linq_Extensions_Nodes__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Nodes<T>(IEnumerable<T>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.remove?view=netframework-4.7#System_Xml_Linq_Extensions_Remove_System_Collections_Generic_IEnumerable_System_Xml_Linq_XAttribute__" data-linktype="relative-path">Remove(IEnumerable<XAttribute>)</a></span> </td> </tr> <tr> <td colspan="2"> <span class="lang-csharp"><a class="xref" href="system.xml.linq.extensions.remove?view=netframework-4.7#System_Xml_Linq_Extensions_Remove__1_System_Collections_Generic_IEnumerable___0__" data-linktype="relative-path">Remove<T>(IEnumerable<T>)</a></span> </td> </tr> </table> <h2 class="accented">Thread Safety</h2> <p>This type is thread safe.</p> <div id="comments-container" ms.cmpgrp="comments" data-bi-name="comments" role="form"></div> </div> </main> <div class="pageActions"> <div id="page-actions" ms.cmpgrp="pageactions" data-bi-name="pageactions" role="complementary"> <div id="page-actions-content"> <ul class="action-list"> <li id="contenteditbtn"> <a href="https://github.com/dotnet/docs/blob/master/xml/System/String.xml" title="Edit This Document" ms.cmpnm="edit" data-bi-name="edit"> <i class="icon icon-editor"></i>Edit </a> </li> <li> <a href="#" class="sharebutton" title="Share This Document" ms.cmpnm="share" data-bi-name="share"><i class="icon icon-share"></i>Share</a> <div class="share-container"> <div><a href="" class="share-twitter" ms.cmpnm="twitter" data-bi-name="twitter"><i class="icon icon-twitter"></i>Twitter</a></div> <div><a href="" class="share-linkedin" ms.cmpnm="share-linkedin" data-bi-name="linkedin"><i class="icon icon-linkedin"></i>LinkedIn</a></div> <div><a href="" class="share-facebook" ms.cmpnm="facebook" data-bi-name="facebook"><i class="icon icon-facebook"></i>Facebook</a></div> <div><a href="" class="share-email" ms.cmpnm="email" data-bi-name="email"><i class="icon icon-email"></i>Email</a></div> </div> </li> <li class="typeSep">|</li> <li> <label for="lang-selector">Language</label> <select name="lang-selector" id="lang-selector" data-bi-name="select-lang"> <option value="lang-csharp">C#</option> <option value="lang-vb">VB</option> <option value="lang-cpp">C++</option> </select> </li> <li> <label for="theme-selector">Theme</label> <select id="theme-selector" data-bi-name="select-theme"> <option value="" class="removedOnload"></option> <option value="">Light</option> <option value="theme_night">Dark</option> </select> </li> </ul> <nav id="side-doc-outline" class="doc-outline" ms.cmpnm="intopic toc" data-bi-name="intopic toc" role="navigation" aria-label="On page navigation"> <h3>In this article</h3> </nav> </div> </div> </div> <ul class="breadcrumbs" ms.cmpgrp="breadcrumb" data-bi-name="breadcrumb" role="navigation" aria-label="breadcrumb"><li></li></ul> <div class="sidebar" id="sidebar" ms.cmpgrp="left toc" data-bi-name="left toc" role="navigation" aria-label="main navigation" lang="en-us" dir="ltr"> <div id="sidebarContent"> <div class="filterHolder"> </div> <nav class="toc"></nav> <div class="pdfDownloadHolder"></div> </div> <div class="tocSpace"></div> </div> <div id="menu-nav" class="dropdown-container" lang="en-us" dir="ltr"> <div class="dropdown dropdown-full mobilenavi"> <select> </select> </div> </div> </div> <div id="openFeedbackContainer" class="openfeedback-container footer-layout"></div> <div class="container footerContainer" > <footer id="footer" ms.pgarea="footer" data-bi-name="footer" class="footer-layout"> <div class="container" role="contentinfo"> <a id="locale-selector-link" href="#" data-bi-name="select-locale" ms.cmpnm="select-locale"></a> <ul class="links" ms.cmpgrp="footerlinks" data-bi-name="footerlinks"> <li><a id="footer-about-link" href="https://docs.microsoft.com/teamblog" ms.cmpnm="bloglink" data-bi-name="bloglink">Blog</a></li> <li><a id="footer-privacy-link" href="//privacy.microsoft.com/en-us/" ms.cmpnm="privacy" data-bi-name="privacy">Privacy & Cookies</a></li> <li><a id="footer-term-of-use" href="/en-us/legal/termsofuse" ms.cmpnm="termsofuse" data-bi-name="termsofuse">Terms of Use</a></li> <li><a href="//aka.ms/sitefeedback" ms.cmpnm="feedback" data-bi-name="feedback">Feedback</a></li> <li id="impressum-section" hidden><a id="impressum-link" href="#" ms.cmpnm="impressum" data-bi-name="impressum">Impressum</a></li> <li><a href="https://www.microsoft.com/en-us/legal/intellectualproperty/Trademarks/EN-US.aspx" ms.cmpnm="trademarks" data-bi-name="trademarks">Trademarks</a></li> </ul> </div> </footer> </div>
Script Preparation code:
// remove all existing meta tags (function() { var tags = document.querySelectorAll('meta'); var i = tags.length; while(i--) { tags.item(i).parentElement.removeChild(tags.item(i)); } })(); // add meta tags from System.String ref page. document.head.insertAdjacentHTML('afterbegin', '<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta property="og:title" content="String Class (System)" /><meta property="og:image" content="https://docs.microsoft.com/_themes/docs.theme/master/en-us/_themes/images/microsoft-header.png" /><meta name="twitter:card" content="summary" /><meta name="twitter:site" content="@docsmsft" /><meta name="twitter:title" content="String Class (System)" /><meta name="twitter:description" content="Represents text as a sequence of UTF-16 code units. " /><meta name="twitter:image" content="https://docs.microsoft.com/_themes/docs.theme/master/en-us/_themes/images/microsoft-header.png" /><meta name="twitter:image:alt" content="Microsoft Logo" /><meta name="monikers" content="netcore-1.0" /><meta name="monikers" content="netcore-1.1" /><meta name="monikers" content="netcore-2.0" /><meta name="monikers" content="netframework-4.5.1" /><meta name="monikers" content="netframework-4.5.2" /><meta name="monikers" content="netframework-4.5" /><meta name="monikers" content="netframework-4.6.1" /><meta name="monikers" content="netframework-4.6.2" /><meta name="monikers" content="netframework-4.6" /><meta name="monikers" content="netframework-4.7" /><meta name="monikers" content="netstandard-1.0" /><meta name="monikers" content="netstandard-1.1" /><meta name="monikers" content="netstandard-1.2" /><meta name="monikers" content="netstandard-1.3" /><meta name="monikers" content="netstandard-1.4" /><meta name="monikers" content="netstandard-1.5" /><meta name="monikers" content="netstandard-1.6" /><meta name="monikers" content="netstandard-2.0" /><meta name="monikers" content="xamarinandroid-7.1" /><meta name="monikers" content="xamarinios-10.8" /><meta name="monikers" content="xamarinmac-3.0" /><meta name="original_ref_skeleton_git_url" content="https://github.com/dotnet/docs/blob/master/xml/System/String.xml" /><meta name="ms.technology" content="dotnet-standard" /><meta name="author" content="rpetrusha" /><meta name="ms.author" content="ronpet" /><meta name="manager" content="wpickett" /><meta name="search.ms_sitename" content="Docs" /><meta name="search.ms_docsetname" content="core-docs" /><meta name="locale" content="en-us" /><meta name="site_name" content="Docs" /><meta name="search.ms_product" content="VS" /><meta name="depot_name" content="VS.core-docs" /><meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /><meta name="breadcrumb_path" content="/dotnet/toc.json" /><meta name="apiPlatform" content="dotnet" /><meta name="ms.topic" content="managed-reference" /><meta name="ms.prod" content=".net" /><meta name="uhfHeaderId" content="MSDocsHeader-DotNet" /><meta name="APIName" content="System.String" /><meta name="APILocation" content="System.Runtime.dll" /><meta name="APILocation" content="mscorlib.dll" /><meta name="APILocation" content="netstandard.dll" /><meta name="TopicType" content="apiref" /><meta name="APIType" content="Assembly" /><meta name="updated_at" content="2017-08-30 02:11 PM" /><meta name="original_content_git_url" content="https://github.com/dotnet/docs/blob/live/api/overwrites/System.String.misc.md" /><meta name="document_id" content="7eb81599-a548-5d41-4013-812d9148b09d" /><meta name="pagetype" content="Reference" /><meta name="description" content="Represents text as a sequence of UTF-16 code units. " /><meta name="toc_rel" content="_splitted/System/toc.json" /><meta name="source_url" content="" /><meta name="ms.assetid" content="System.String" /><meta name="pdf_url_template" content="https://docs.microsoft.com/pdfstore/en-us/VS.core-docs/{branchName}{pdfName}" /><meta name="scope" content=".NET" />'); // src/themes/javascript/docs.metadata.js function srcThemesJavascriptDocsMetadata(metadataName) { var metaElement = $("meta[name=\"" + metadataName + "\"]"); if (metaElement.length !== 1) { return null; } return metaElement.first().attr("content"); } // params.ts function getParam(name, type) { if (type === 'meta') { var selector = "meta[name=\"" + name + "\"]"; var metaTag = document.querySelector(selector); return metaTag ? metaTag.content : undefined; } var frag = type === 'hash' ? window.location.hash : window.location.search; if (frag.length > 1) { frag = frag.substring(1); var cmpstring = name + "="; var cmplen = cmpstring.length; var temp = frag.split("&"); for (var i = 0; i < temp.length; i++) { if (temp[i].substr(0, cmplen) == cmpstring) { return temp[i].substr(cmplen); } } } return undefined; } // new getMeta function var metaDictionary; function readMetaTags() { metaDictionary = {}; var metaTags = document.head.querySelectorAll('meta'); for (var i = 0; i < metaTags.length; i++) { var meta = metaTags.item(i); if (metaDictionary[meta.name]) { metaDictionary[meta.name].push(meta.content); } else { metaDictionary[meta.name] = [meta.content]; } } } function getMeta(name) { if (metaDictionary === undefined) { readMetaTags(); } return metaDictionary[name] === undefined ? undefined : metaDictionary[name][0]; }
Tests:
docs.metadata.js
if (srcThemesJavascriptDocsMetadata('apiPlatform') !== 'dotnet') { throw new Error('benchmark is broken'); } srcThemesJavascriptDocsMetadata('toc_rel'); srcThemesJavascriptDocsMetadata('pdf_url_template'); srcThemesJavascriptDocsMetadata('monikers'); srcThemesJavascriptDocsMetadata('uhfHeaderId'); srcThemesJavascriptDocsMetadata('pagetype'); srcThemesJavascriptDocsMetadata('breadcrumb_path'); srcThemesJavascriptDocsMetadata('hide_bc'); srcThemesJavascriptDocsMetadata('scope'); srcThemesJavascriptDocsMetadata('hideScope'); srcThemesJavascriptDocsMetadata('ms.pagetype'); srcThemesJavascriptDocsMetadata('somethingthatdoesnotexist'); srcThemesJavascriptDocsMetadata('somethingelse'); srcThemesJavascriptDocsMetadata('bilingual_type'); srcThemesJavascriptDocsMetadata('ms.translationtype'); srcThemesJavascriptDocsMetadata('ms.assetId');
params.ts
if (getParam('apiPlatform', 'meta') !== 'dotnet') { throw new Error('benchmark is broken'); } getParam('toc_rel', 'meta'); getParam('pdf_url_template', 'meta'); getParam('monikers', 'meta'); getParam('uhfHeaderId', 'meta'); getParam('pagetype', 'meta'); getParam('breadcrumb_path', 'meta'); getParam('hide_bc', 'meta'); getParam('scope', 'meta'); getParam('hideScope', 'meta'); getParam('ms.pagetype', 'meta'); getParam('somethingthatdoesnotexist', 'meta'); getParam('somethingelse', 'meta'); getParam('bilingual_type', 'meta'); getParam('ms.translationtype', 'meta'); getParam('ms.assetId', 'meta');
meta.ts
var metaDictionary = undefined; if (getMeta('apiPlatform') !== 'dotnet') { throw new Error('benchmark is broken'); } getMeta('toc_rel'); getMeta('pdf_url_template'); getMeta('monikers'); getMeta('uhfHeaderId'); getMeta('pagetype'); getMeta('breadcrumb_path'); getMeta('hide_bc'); getMeta('scope'); getMeta('hideScope'); getMeta('ms.pagetype'); getMeta('somethingthatdoesnotexist'); getMeta('somethingelse'); getMeta('bilingual_type'); getMeta('ms.translationtype'); getMeta('ms.assetId');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
docs.metadata.js
params.ts
meta.ts
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Based on the provided benchmark data, I will analyze the performance of each test case. **Test Case Analysis** 1. `meta.ts`: * Average Execution Time: 22.995847702026367 seconds * Execution Rate: 68007.25 executions per second (high) 2. `params.ts`: * Average Execution Time: 47.7544059753418 seconds * Execution Rate: 2049.42 executions per second (medium-low) 3. `docs.metadata.js`: * Average Execution Time: 68007.25 seconds (very high) **Conclusion** The results indicate that the test cases have different performance characteristics. 1. `meta.ts`: This test case has a relatively fast execution time and a high execution rate, suggesting it is well-optimized. 2. `params.ts`: This test case has a slower execution time compared to `meta.ts`, but still a respectable execution rate. 3. `docs.metadata.js`: This test case has the slowest execution time and the lowest execution rate, indicating potential performance issues or optimization opportunities. **Recommendations** 1. Review and optimize `docs.metadata.js` for improved performance. 2. Consider refactoring `params.ts` to reduce execution time, possibly by caching or memoizing results. 3. Continue monitoring and optimizing `meta.ts`, as it currently appears to be the fastest test case.
Related benchmarks:
Selecting - Plain JS vs. jQuery vs. Hybrid
Selecting and Hiding - Plain JS vs. jQuery vs. Hybrid
metadata retrieval
body vs querySelector
Comments
Confirm delete:
Do you really want to delete benchmark?