This documentation is archived and is not being maintained.
String::Equals Method (String, StringComparison)
Visual Studio 2010
Determines whether this string and a specified String object have the same value. A parameter specifies the culture, case, and sort rules used in the comparison.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
- Type: System::String
The string to compare to this instance.
- comparisonType
- Type: System::StringComparison
One of the enumeration values that specifies how the strings will be compared.
Return Value
Type: System::Booleantrue if the value of the value parameter is the same as this string; otherwise, false.
| Exception | Condition |
|---|---|
| ArgumentException | comparisonType is not a StringComparison value. |
The following example creates a string array that consists of an uppercase "I", a lowercase "i", and a dotless "ı". It then calls the Equals(String, StringComparison) method to compare them by using each possible StringComparison enumeration value.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: