/// <summary>
 /// Converts this BsonBinaryData to a Guid.
 /// </summary>
 /// <param name="guidRepresentation">The representation for Guids.</param>
 /// <returns>A Guid.</returns>
 public Guid ToGuid(GuidRepresentation guidRepresentation)
 {
     if (_subType != BsonBinarySubType.UuidStandard && _subType != BsonBinarySubType.UuidLegacy)
     {
         var message = string.Format("SubType must be UuidStandard or UuidLegacy, not {0}.", _subType);
         throw new InvalidOperationException(message);
     }
     if (guidRepresentation == GuidRepresentation.Unspecified)
     {
         throw new ArgumentException("GuidRepresentation cannot be Unspecified.");
     }
     return(GuidConverter.FromBytes(_bytes, guidRepresentation));
 }
 /// <summary>
 /// Initializes a new instance of the BsonBinaryData class.
 /// </summary>
 /// <param name="guid">A Guid.</param>
 /// <param name="guidRepresentation">The representation for Guids.</param>
 public BsonBinaryData(Guid guid, GuidRepresentation guidRepresentation)
     : this(GuidConverter.ToBytes(guid, guidRepresentation), (guidRepresentation == GuidRepresentation.Standard) ? BsonBinarySubType.UuidStandard : BsonBinarySubType.UuidLegacy, guidRepresentation)
 {
 }