Method HasExtension
HasExtension(string?, string, StringComparison)
Checks if the specified path has the given file extension.
public static bool HasExtension(string? path, string ext, StringComparison comparison = StringComparison.OrdinalIgnoreCase)
Parameters
pathstringThe path to check for the extension.
extstringThe file extension to check for.
comparisonStringComparisonThe StringComparison to use for the check.
Returns
- bool
trueif the path has the specified extension; otherwise,false.