GetFileName Method
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Returns the file name and extension of the specified path string.
Namespace: System.IO
Assembly: System.IO (in System.IO.dll)
Syntax
'Declaration
Public Shared Function GetFileName ( _
path As String _
) As String
public static string GetFileName(
string path
)
public:
static String^ GetFileName(
String^ path
)
static member GetFileName :
path:string -> string
public static function GetFileName(
path : String
) : String
Parameters
- path
Type: System. . :: . .String
The path string from which to obtain the file name and extension.
Return Value
Type: System. . :: . .String
The characters after the last directory character in path. If the last character of path is a directory or volume separator character, this method returns String..::..Empty. If path is nullNothingnullptrunita null reference (Nothing in Visual Basic), this method returns nullNothingnullptrunita null reference (Nothing in Visual Basic).
Remarks
The returned value is null Nothing nullptr unit a null reference (Nothing in Visual Basic) if the file path is null Nothing nullptr unit a null reference (Nothing in Visual Basic) .
The separator characters used to determine the start of the file name are DirectorySeparatorChar.
.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.