System.IO.Path.GetFileNameWithoutExtension Method

Returns the file name of the specified path string without the extension.

Syntax

public static string GetFileNameWithoutExtension (string path)

Parameters

path
The path of the file.

Returns

The string returned by Path.GetFileName(string), minus the last period (.) and all characters following it.

Exceptions

TypeReason
ArgumentException path contains one or more implementation-specific invalid characters.

Remarks

This method does not verify that the path or file name exists.

For a list of common I/O tasks, see Common I/O Tasks.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0