FilePathExtensions.

HasFileExtension(FilePath, string) Method

Summary

Checks if the path has a specific file extension (case-insensitive)

Syntax

public static bool HasFileExtension(this FilePath path, string fileExtension)

Examples

Check the file extension with or without the period ignoring case
new FilePath("/folder/testing.cs").HasExtension(".cs"); // true
new FilePath("/folder/testing.odd").HasExtension("ODD"); // true

Parameters

Name Type Description
path FilePath the path to check
fileExtension string the file extension name

Return Value

Type Description
bool true if file extension matches