Exemplo n.º 1
0
 /// <summary>
 /// Returns a C# character literal with the given value.
 /// </summary>
 /// <param name="c">The value that the resulting character literal should have.</param>
 /// <param name="quote">True to put (single) quotes around the character literal.</param>
 /// <returns>A character literal with the given value.</returns>
 /// <remarks>
 /// Escapes non-printable characters.
 /// </remarks>
 public static string FormatLiteral(char c, bool quote)
 {
     return(ObjectDisplay.FormatLiteral(c, quote ? ObjectDisplayOptions.UseQuotes : ObjectDisplayOptions.None));
 }
Exemplo n.º 2
0
 string INumericTC <char> .ToString(char c)
 {
     return(ObjectDisplay.FormatPrimitive(c, ObjectDisplayOptions.EscapeNonPrintableCharacters | ObjectDisplayOptions.UseQuotes));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Returns a C# string literal with the given value.
 /// </summary>
 /// <param name="value">The value that the resulting string literal should have.</param>
 /// <param name="quote">True to put (double) quotes around the string literal.</param>
 /// <returns>A string literal with the given value.</returns>
 /// <remarks>
 /// Escapes non-printable characters.
 /// </remarks>
 public static string FormatLiteral(string value, bool quote)
 {
     return(ObjectDisplay.FormatLiteral(value, quote));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns a C# character literal with the given value.
 /// </summary>
 /// <param name="c">The value that the resulting character literal should have.</param>
 /// <param name="quote">True to put (single) quotes around the character literal.</param>
 /// <returns>A character literal with the given value.</returns>
 /// <remarks>
 /// Escapes non-printable characters.
 /// </remarks>
 public static string FormatLiteral(char c, bool quote)
 {
     return(ObjectDisplay.FormatLiteral(c, quote));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Returns a string representation of an object of primitive type.
 /// </summary>
 /// <param name="obj">A value to display as a string.</param>
 /// <param name="quoteStrings">Whether or not to quote string literals.</param>
 /// <param name="useHexadecimalNumbers">Whether or not to display integral literals in hexadecimal.</param>
 /// <returns>A string representation of an object of primitive type (or null if the type is not supported).</returns>
 /// <remarks>
 /// Handles <see cref="bool"/>, <see cref="string"/>, <see cref="char"/>, <see cref="sbyte"/>
 /// <see cref="byte"/>, <see cref="short"/>, <see cref="ushort"/>, <see cref="int"/>, <see cref="uint"/>,
 /// <see cref="long"/>, <see cref="ulong"/>, <see cref="double"/>, <see cref="float"/>, <see cref="decimal"/>,
 /// and <c>null</c>.
 /// </remarks>
 public static string FormatPrimitive(object obj, bool quoteStrings, bool useHexadecimalNumbers)
 {
     return(ObjectDisplay.FormatPrimitive(obj, quoteStrings, useHexadecimalNumbers));
 }