Class BsonBinaryData
Represents BSON binary data.
[Serializable]
public class BsonBinaryData : BsonValue, IComparable<BsonValue>, IConvertible, IEquatable<BsonValue>, IComparable<BsonBinaryData>, IEquatable<BsonBinaryData>
- Inheritance
-
BsonBinaryData
- Implements
- Inherited Members
- Extension Methods
Constructors
BsonBinaryData(byte[])
Initializes a new instance of the BsonBinaryData class.
public BsonBinaryData(byte[] bytes)
Parameters
bytes
byte[]The binary data.
BsonBinaryData(byte[], BsonBinarySubType)
Initializes a new instance of the BsonBinaryData class.
public BsonBinaryData(byte[] bytes, BsonBinarySubType subType)
Parameters
bytes
byte[]The binary data.
subType
BsonBinarySubTypeThe binary data subtype.
BsonBinaryData(byte[], BsonBinarySubType, GuidRepresentation)
Initializes a new instance of the BsonBinaryData class.
[Obsolete("This constructor will be removed in a later release.")]
public BsonBinaryData(byte[] bytes, BsonBinarySubType subType, GuidRepresentation guidRepresentation)
Parameters
bytes
byte[]The binary data.
subType
BsonBinarySubTypeThe binary data subtype.
guidRepresentation
GuidRepresentationThe representation for Guids.
BsonBinaryData(Guid)
Initializes a new instance of the BsonBinaryData class.
[Obsolete("Use the constructor that also takes a GuidRepresentation instead.")]
public BsonBinaryData(Guid guid)
Parameters
guid
GuidA Guid.
BsonBinaryData(Guid, GuidRepresentation)
Initializes a new instance of the BsonBinaryData class.
public BsonBinaryData(Guid guid, GuidRepresentation guidRepresentation)
Parameters
guid
GuidA Guid.
guidRepresentation
GuidRepresentationThe representation for Guids.
Properties
BsonType
Gets the BsonType of this BsonValue.
public override BsonType BsonType { get; }
Property Value
Bytes
Gets the binary data.
public byte[] Bytes { get; }
Property Value
- byte[]
GuidRepresentation
Gets the representation to use when representing the Guid as BSON binary data.
[Obsolete("This property will be removed in a later release.")]
public GuidRepresentation GuidRepresentation { get; }
Property Value
RawValue
Gets the BsonBinaryData as a Guid if the subtype is UuidStandard or UuidLegacy, otherwise null.
[Obsolete("Use Value instead.")]
public override object RawValue { get; }
Property Value
SubType
Gets the binary data subtype.
public BsonBinarySubType SubType { get; }
Property Value
Methods
CompareTo(BsonBinaryData)
Compares this BsonBinaryData to another BsonBinaryData.
public int CompareTo(BsonBinaryData other)
Parameters
other
BsonBinaryDataThe other BsonBinaryData.
Returns
- int
A 32-bit signed integer that indicates whether this BsonBinaryData is less than, equal to, or greather than the other.
CompareTo(BsonValue)
Compares the BsonBinaryData to another BsonValue.
public override int CompareTo(BsonValue other)
Parameters
other
BsonValueThe other BsonValue.
Returns
- int
A 32-bit signed integer that indicates whether this BsonBinaryData is less than, equal to, or greather than the other BsonValue.
Create(object)
Creates a new BsonBinaryData.
public static BsonBinaryData Create(object value)
Parameters
value
objectAn object to be mapped to a BsonBinaryData.
Returns
- BsonBinaryData
A BsonBinaryData or null.
Equals(BsonBinaryData)
Compares this BsonBinaryData to another BsonBinaryData.
public bool Equals(BsonBinaryData rhs)
Parameters
rhs
BsonBinaryDataThe other BsonBinaryData.
Returns
- bool
True if the two BsonBinaryData values are equal.
Equals(object)
Compares this BsonBinaryData to another object.
public override bool Equals(object obj)
Parameters
obj
objectThe other object.
Returns
- bool
True if the other object is a BsonBinaryData and equal to this one.
GetHashCode()
Gets the hash code.
public override int GetHashCode()
Returns
- int
The hash code.
ToGuid()
Converts this BsonBinaryData to a Guid.
public Guid ToGuid()
Returns
- Guid
A Guid.
ToGuid(GuidRepresentation)
Converts this BsonBinaryData to a Guid.
public Guid ToGuid(GuidRepresentation guidRepresentation)
Parameters
guidRepresentation
GuidRepresentationThe representation for Guids.
Returns
- Guid
A Guid.
ToString()
Returns a string representation of the binary data.
public override string ToString()
Returns
- string
A string representation of the binary data.
Operators
operator ==(BsonBinaryData, BsonBinaryData)
Compares two BsonBinaryData values.
public static bool operator ==(BsonBinaryData lhs, BsonBinaryData rhs)
Parameters
lhs
BsonBinaryDataThe first BsonBinaryData.
rhs
BsonBinaryDataThe other BsonBinaryData.
Returns
- bool
True if the two BsonBinaryData values are equal according to ==.
implicit operator BsonBinaryData(byte[])
Converts a byte array to a BsonBinaryData.
public static implicit operator BsonBinaryData(byte[] bytes)
Parameters
bytes
byte[]A byte array.
Returns
- BsonBinaryData
A BsonBinaryData.
implicit operator BsonBinaryData(Guid)
Converts a Guid to a BsonBinaryData.
[Obsolete("Use the BsonBinaryData constructor instead and specify a Guid representation.")]
public static implicit operator BsonBinaryData(Guid value)
Parameters
value
GuidA Guid.
Returns
- BsonBinaryData
A BsonBinaryData.
operator !=(BsonBinaryData, BsonBinaryData)
Compares two BsonBinaryData values.
public static bool operator !=(BsonBinaryData lhs, BsonBinaryData rhs)
Parameters
lhs
BsonBinaryDataThe first BsonBinaryData.
rhs
BsonBinaryDataThe other BsonBinaryData.
Returns
- bool
True if the two BsonBinaryData values are not equal according to ==.