public static bool IsGUID(byte[] bytes)
{
bool isGUID = false;
// Check GUID length with 16.
if (bytes != null && bytes.Length == 16)
{
Guid guid = new Guid(bytes);
// GUID format check regExpression.
string regexPatten = @"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\"
+ @"-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$";
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(regexPatten);
string guidStr = guid.ToString();
isGUID = regex.IsMatch(guidStr);
}
return isGUID;
}