C#StringEndsWith

Determines whether the string ends with the specified characters.

Syntax

str.EndsWith(value, comparisonType?)

Example

Enter values below to update the example in real time.

string
filename
isPdf
EndsWith
Console
WriteLine
string filename = "report.pdf";
bool isPdf = filename.EndsWith(".pdf");
Console.WriteLine(isPdf);   // True