String.Format for Hex

后端 未结 5 1442
星月不相逢
星月不相逢 2020-12-14 05:52

With below code, the colorsting always gives #DDDD. Green, Red and Space values int he How to fix this?

string colorstring;
int Blue = 13;
int Green = 0;
int         


        
5条回答
  •  天命终不由人
    2020-12-14 06:46

    More generally.

    byte[] buf = new byte[] { 123, 2, 233 };
    
    string s = String.Concat(buf.Select(b => b.ToString("X2")));
    

提交回复
热议问题