Question

I'm making some sevices for an iPad app to consume ad send data to CRM Dynamics. During the process I bumped into this weird, yet fasincating problem.

I have to assign a Guid to some records that have yet to be assigned to some other entity. As this Guid can change I put it on a variable and create the Guid pogramatically, this way (sorry to type so long for such a little thing)

new Guid("31033981b158e31187e700155d094430‏");

But this is thorwing a Format Exception that only says that a guid should have 32 digits and 4 dashes. I'm using here a perfectly valid override of the constructor in which I can send only digits.

Well, I also tried the example in the MSDN documentation like this

new Guid("ca761232ed4211cebacd00aa0057b223");

and it worked.

So, the question is, What is the diofference between the two Guids?

Était-ce utile?

La solution

Well, it looks like it's a valid GUID string with 32 hex digits, but it is not.

When copying your string into an editor I see that the very last character is unicode point 8207, Rigth to left mark. It's an unprintable character, but it's there. Try this instead:

new Guid("31033981b158e31187e700155d094430");

You can't see the difference in your browser, but it will work - I removed the unprintable character from your string.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top