Mono Class Library: System.IO.Path Overview | Members

System.IO.Path.ChangeExtension Method

Changes the extension component of the specified path string.

public static string ChangeExtension (string path, string extension)

Parameters

path
A string containing the path information to modify.
extension
A string containing the new extension. Specify null to remove an existing extension from path.

Returns

A string containing the modified path information.

Platforms that do not support this feature return path unmodified.

Exceptions

TypeReason
ArgumentExceptionpath contains one or more implementation-specific invalid characters.

Remarks

The exact behavior of this method is implementation-specific. This method checks path for invalid characters as defined by the current platform and file system.

Requirements

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