Search code examples
c#c++-cliguid

How can I convert string to Guid?


I have string type value like "e2ddfa02610e48e983824b23ac955632". I need to add - in this code means convert in Guid.

EntityKey = "e2ddfa02610e48e983824b23ac955632";
Id = (Guid)paymentRecord.EntityKey;

Solution

  • Just a simple creation:

      String source = "e2ddfa02610e48e983824b23ac955632";
    
      Guid result = new Guid(source);