ToBytes() public static method

Converts a Guid to a byte array.
public static ToBytes ( System.Guid guid, GuidRepresentation representation ) : byte[]
guid System.Guid The Guid.
representation GuidRepresentation The representation of the Guid in the byte array.
return byte[]
コード例 #1
0
 /// <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
         )
 {
 }
コード例 #2
0
ファイル: BsonBinaryData.cs プロジェクト: x00568/ET
#pragma warning restore 618

        /// <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)
        {
            _bytes   = GuidConverter.ToBytes(guid, guidRepresentation);
            _subType = GuidConverter.GetSubType(guidRepresentation);
#pragma warning disable 618
            if (BsonDefaults.GuidRepresentationMode == GuidRepresentationMode.V2)
            {
                _guidRepresentation = guidRepresentation;
            }
#pragma warning restore 618
        }