NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

File.GetExtension

Returns the extension of the specified path.

[Visual Basic]
Public Shared Function GetExtension( _
   ByVal path As String _
) As String
[C#]
public static string GetExtension(
   string path
);
[C++]
public: static String* GetExtension(
   String* path
);
[JScript]
public static function GetExtension(
   path : String
) : String;

Parameters

path
The path of a file or directory.

Return Value

The extension of the specified path (including the "."), or Empty.

Exceptions

Exception Type Condition
ArgumentNullException path is a null reference (in Visual Basic Nothing).
ArgumentException path is empty or contains only whitespaces.

Remarks

The extension is obtained by searching backwards within path for the "." character. If "." is matched before Environment.DirectorySeparatorChar, Environment.AltDirectorySeparatorChar, or Environment.VolumeSeparatorChar is encountered, then the "." and the characters following the "." are returned as the result. Otherwise, Empty is returned.

The returned value includes the period (".") character of the extension, such as ".exe" or ".cpp".

See Also

File Class | File Members | System.IO Namespace