Path.HasExtension Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Determines whether a path includes a file name extension.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- path
- Type: System.String
The path to search for an extension.
Return Value
Type: System.Booleantrue if the characters that follow the last directory separator (\\ or /) or volume separator (:) in the path include a period (.) followed by one or more characters; otherwise, false.
| Exception | Condition |
|---|---|
| ArgumentException | path contains one or more of the invalid characters defined in GetInvalidPathChars. |
Starting from the end of path, this method searches for a period (.) followed by at least one character. If this pattern is found before a DirectorySeparatorChar, AltDirectorySeparatorChar, or VolumeSeparatorChar character is encountered, this method returns true.