标签:string sys tst enc wpf lin output odi nic
原文:WPF中的一些常用类型转换1.string和Color的转换:
//string转Color (Color)ColorConverter.ConvertFromString((string)str); //Color转string ((Color)value).ToString();
2.string和Brush的转换:
//string转Brush Brush color = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)str)); //Brush转string ((Brush)value).ToString();
3.string和byte[]的转换:
//string转byte[] System.Text.UnicodeEncoding converter = new System.Text.UnicodeEncoding(); byte[] stringBytes = converter.GetBytes(inputString); //byte[]转string System.Text.UnicodeEncoding converter = new System.Text.UnicodeEncoding(); string outputString = converter.GetString(stringByte);
标签:string sys tst enc wpf lin output odi nic
原文地址:https://www.cnblogs.com/lonelyxmas/p/9589374.html