HasExtension Method
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Determines whether a path includes a file name extension.
Namespace: System.IO
Assembly: System.IO (in System.IO.dll)
Syntax
'Declaration
Public Shared Function HasExtension ( _
path As String _
) As Boolean
public static bool HasExtension(
string path
)
public:
static bool HasExtension(
String^ path
)
static member HasExtension :
path:string -> bool
public static function HasExtension(
path : String
) : boolean
Parameters
- path
Type: System. . :: . .String
The path to search for an extension.
Return Value
Type: System. . :: . .Boolean
true 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.
Exceptions
Exception | Condition |
---|---|
ArgumentException | path contains one or more of the invalid characters defined in GetInvalidPathChars. |
Remarks
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 character is encountered, this method returns true.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.