Is there a GUID.TryParse() in .NET 3.5?

后端 未结 7 1513
遇见更好的自我
遇见更好的自我 2021-01-07 16:25

UPDATE

Guid.TryParse is available in .NET 4.0

END UPDATE

Obviously there is no public GUID.TryParse() in .NET CLR

相关标签:
7条回答
  • 2021-01-07 16:52

    There is no Guid.TryParse in CLR 2.0 and earlier. It will be available starting with CLR 4.0 and Visual Studio 2010.

    As to why there wasn't. These types of questions are usually hard to answer correctly. Most likely it was an oversight or a time constraint issue. If you open up mscorlib in reflector you'll see there is actually a method named TryParse on Guid but it's private. It also throws an exception in certain cases so it's not a good equivalent to say Int32.TryParse.

    0 讨论(0)
提交回复
热议问题