How to convert color name to the corresponding hexadecimal representation?

You're half way there. Use .ToArgb to convert it to it's numberical value, then format it as a hex value.

int ColorValue = Color.FromName("blue").ToArgb();
string ColorHex = string.Format("{0:x6}", ColorValue);

var rgb = color.ToArgb() & 0xFFFFFF; // drop A component
var hexString = String.Format("#{0:X6}", rgb);

or just

var hexString = String.Format("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);

{
    Color color = Color.FromName("blue");
    byte g = color.G;
    byte b = color.B;
    byte r = color.R;
    byte a = color.A;
    string text = String.Format("Color RGBA values: red:{0x}, green: {1}, blue {2}, alpha: {3}", new object[]{r, g, b, a});

// seriously :) this is simple:

    string hex = String.Format("#{0:x2}{1:x2}{2:x2}", new object[]{r, g, b}); 

}