System.String.EndsWith Method

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

Syntax

[System.Runtime.InteropServices.ComVisible(false)]
public bool EndsWith (string value, StringComparison comparisonType)

Parameters

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

Returns

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

Remarks

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.

Requirements

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