How to try convert a string to a Guid [duplicate]

I did not find the TryParse method for the Guid. I’m wondering how others handle converting a guid in string format into a guid type.

Guid Id;
try
{
    Id = new Guid(Request.QueryString["id"]);
}
catch
{
    Id = Guid.Empty;
}

6 Answers
6

Leave a Comment