BluetoothLE.Core.Extensions.ToGuid C# (CSharp) Method

ToGuid() public static method

Convert a UUID to a Guid by using it as the first part of the Guid {0}-0000-1000-8000-00805f9b34fb
public static ToGuid ( this uuid ) : System.Guid
uuid this The UUID to convert. /// If the string is 4 characters, "0000" will be appended before creating the Guid. /// If the string is 8 characters, nothing is appended before creating the Guid. /// If the string is not 4 characters or 8 characters, the exact Guid is parsed from the input. ///
return System.Guid
		public static Guid ToGuid(this string uuid)
		{
			if (uuid.Length == 4) {
				// 4 character prefix
				uuid = string.Format(IdFormat, "0000", uuid);
			} else if (uuid.Length == 8) {
				// no prefix required
				uuid = string.Format(IdFormat, uuid, "");
			}
			return Guid.ParseExact (uuid, "d");
		}
	}
Extensions