System.String.EndsWith Method

Determines whether the end of this string instance matches the specified string when compared using the specified comparison option.


public bool EndsWith (string value, StringComparison comparisonType)


The string to compare to the substring at the end of this instance.
One of the enumeration values that determines how this string and value are compared.


true if the value parameter matches the end of this string; otherwise, false.


The string.EndsWith(string, StringComparison) method compares the value parameter to the substring at the end of this string and returns a value that indicates whether they are equal. To be equal, value must be a reference to this same string, must be the empty string (""), or must match the end of this string. The type of comparison performed by the string.EndsWith(string, StringComparison) method depends on the value of the comparisonType parameter.


Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0