Test if string is a guid without throwing exceptions?
I want to try to convert a string to a Guid, but I don't want to rely on catching exceptions ( for performance reasons - exceptions are expensive for usability reasons - the debugger pops up for design reasons - the expected is not exceptional In other words the code: public static Boolean TryStrToGuid(String s, out Guid value) { try { value = new Guid(s); return true; } catch (FormatException) { value = Guid.Empty; return false; } } is not suitable. I would try using RegEx, but since the guid can be parenthesis wrapped, brace wrapped, none wrapped, makes it hard. Additionally, I thought