METHOD

String.EndsWith (StringComparison)

Tests a suffix using the explicitly selected comparison. An extension check alone does not establish a file’s content or trustworthiness.

Formal Syntax & Structure

csharp syntaxcsharp
text.EndsWith(suffix, StringComparison.OrdinalIgnoreCase)

Working Example

Example Snippetcsharp
using System;Console.WriteLine("notes.TXT".EndsWith(".txt", StringComparison.OrdinalIgnoreCase)); // True
C# & .NET Reference