Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

C# how to create a Guid value?

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

2 Answers

akshay1995

Guid id = Guid.NewGuid();
RoliMishra
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.

Login / Signup to Answer the Question.