C# how to create a Guid value?

One field of our struct is Guid type. How to generate a valid value for it?


Guid id = Guid.NewGuid();

Guid.NewGuid()创建一个新的随机guid。


There are two ways

var guid = Guid.NewGuid();

or

var guid = Guid.NewGuid().ToString();

both use the Guid class, the first creates a Guid Object, the second a Guid string.

链接地址: http://www.djcxy.com/p/22104.html

上一篇: Guid.NewGuid()与新的Guid()

下一篇: C#如何创建一个Guid值?