Training
Module
Format alphanumeric data for presentation in C# - Training
Explore basic methods in C# to format alphanumeric data.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Certain characters have special meaning in MSBuild project files. Examples of the characters include semicolons (;
) and asterisks (*
). For a complete list of these special characters, see MSBuild special characters.
In order to use these special characters as literals in a project file, they must be specified by using the syntax %<xx>
, where <xx>
represents the ASCII hexadecimal value of the character.
One example of where special characters are used is in the Include
attribute of item lists. For example, the following item list declares two items: MyFile.cs and MyClass.cs.
<Compile Include="MyFile.cs;MyClass.cs"/>
If you want to declare an item that contains a semicolon in the name, you must use the %<xx>
syntax to escape the semicolon and prevent MSBuild from declaring two separate items. For example, the following item escapes the semicolon and declares one item named MyFile.cs;MyClass.cs
.
<Compile Include="MyFile.cs%3BMyClass.cs"/>
You can also use a property function to escape strings. For example, this is equivalent to the example above.
<Compile Include="$([MSBuild]::Escape('MyFile.cs;MyClass.cs'))" />
Use the notation %<xx>
in place of the special character, where <xx>
represents the hexadecimal value of the ASCII character. For example, to use an asterisk (*
) as a literal character, use the value %2A
.
Training
Module
Format alphanumeric data for presentation in C# - Training
Explore basic methods in C# to format alphanumeric data.