Format string | Meaning | Notes |
---|---|---|
G or g | General | Default |
F or f | Treat as though Flags attribute were present | Works on combined members even if enum has no Flags attribute |
D or d | Decimal value | Retrieves underlying integral value |
X or x | Hexadecimal value | Retrieves underlying integral value |
using System;
using System.Text;
using System.Globalization;
class Sample
{
public static void Main()
{
Console.WriteLine(System.ConsoleColor.Red.ToString("X"));
}
}
The output:
0000000C
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |