StringExt.ReplaceInvalidPathChars Method
Replaces the invalid characters in a path with a given character.
Namespace: UltimateXR.Extensions.System
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0
Syntax
C#
public static string ReplaceInvalidPathChars(
this string self,
char fallbackChar = '_',
params char[] invalidChars
)
Parameters
- self
- Type: System.String
The path to process - fallbackChar (Optional)
- Type: System.Char
The valid character to use as replacement - invalidChars
- Type: System.Char[]
The invalid characters to replace
Return Value
Type: String
New string with the replacements
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
Exception | Condition |
---|---|
ArgumentOutOfRangeException | The replacement character is part of the invalid characters |