指定した文字列で終わるかどうかを確認します。
構文
str.EndsWith(value, comparisonType?)使用例
下記の値を入力するとサンプルに即時反映されます。
string→filename→isPdf→EndsWith→Console→WriteLine→string filename = "report.pdf";
bool isPdf = filename.EndsWith(".pdf");
Console.WriteLine(isPdf); // True