PathFunctions.

ChangeExtension(string, string) Method

Summary

Changes the extension of the path string.
Assembly
NAnt.Core.dll
Namespace
NAnt.Core.Functions
Containing Type
PathFunctions

Syntax

[Function("change-extension")]
public static string ChangeExtension(string path, string extension)

Remarks

For more information see the System.IO.Path documentation.

Attributes

Type Description
FunctionAttribute Indicates that the method should be exposed as a function in NAnt build files.

Parameters

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

Return Value

Type Description
string

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.