Share via


GetExtension Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Returns the extension of the specified path string.

Namespace:  System.IO
Assembly:  System.IO (in System.IO.dll)

Syntax

'Declaration
Public Shared Function GetExtension ( _
    path As String _
) As String
public static string GetExtension(
    string path
)
public:
static String^ GetExtension(
    String^ path
)
static member GetExtension : 
        path:string -> string 
public static function GetExtension(
    path : String
) : String

Parameters

Return Value

Type: System. . :: . .String
The extension of the specified path (including the period "."), or nullNothingnullptrunita null reference (Nothing in Visual Basic), or String..::..Empty. If path is nullNothingnullptrunita null reference (Nothing in Visual Basic), GetExtension returns nullNothingnullptrunita null reference (Nothing in Visual Basic). If path does not have extension information, GetExtension returns String..::..Empty.

Remarks

The extension of path is obtained by searching path for a period (.), starting with the last character in path and continuing toward the start of path. If a period is found before a DirectorySeparatorChar character, the returned string contains the period and the characters after it; otherwise, Empty is returned.

.NET Framework Security

See Also

Reference

Path Class

System.IO Namespace