[This is preliminary documentation and subject to change.]

Changes the extension of the path string.


string path::change-extension(path, extension)


Name Type Description
path string The path information to modify. The path cannot contain any of the characters defined in InvalidPathCharsInvalidPathChars.
extension string The new extension (with a leading period). Specify a null reference to remove an existing extension from path.

Return Value

A string containing the modified path information.

On Windows-based desktop platforms, if path is an empty String, the path information is returned unmodified. If path has no extension, the returned path String contains extension appended to the end of path.


The function will fail in any of the following circumstances:


For more information see the Path documentation.


Assembly: NAnt.Core (0.91.4285.0)