C# 字符串转换为Guid的两种常用方式
static void Main(string[] args)
{
string str = "21140D4D-9CB3-41C1-99DC-30B4BCBE1989";
//string str = "{21140D4D-9CB3-41C1-99DC-30B4BCBE1989}";
// 方式1
Guid g1 = new Guid(str);
// 方式2, .net framework 4.0 以上
Guid g2 = Guid.Parse(str);
Console.Read();
}