Struct ObjectId
A hash to uniquely identify data.
[DataContract("ObjectId")]
[Serializable]
[DataSerializer(typeof(ObjectId.Serializer))]
public struct ObjectId : IEquatable<ObjectId>, IComparable<ObjectId>- Implements
Constructors
ObjectId(byte[])
Initializes a new instance of the ObjectId struct.
public ObjectId(byte[] hash)Parameters
- hashbyte[]
- The hash. 
Exceptions
- ArgumentNullException
- hash 
- InvalidOperationException
- ObjectId value doesn't match expected size. 
ObjectId(uint, uint, uint, uint)
public ObjectId(uint hash1, uint hash2, uint hash3, uint hash4)Parameters
Fields
Empty
public static readonly ObjectId EmptyField Value
HashSize
public const int HashSize = 16Field Value
HashStringLength
public const int HashStringLength = 32Field Value
Methods
Combine(ObjectId, ObjectId)
public static ObjectId Combine(ObjectId left, ObjectId right)Parameters
Returns
Combine(ref ObjectId, ref ObjectId, out ObjectId)
public static void Combine(ref ObjectId left, ref ObjectId right, out ObjectId result)Parameters
CompareTo(ObjectId)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(ObjectId other)Parameters
- otherObjectId
- An object to compare with this instance. 
Returns
- int
- A value that indicates the relative order of the objects being compared. The return value has these meanings: - Value - Meaning - Less than zero - This instance precedes - otherin the sort order.- Zero - This instance occurs in the same position in the sort order as - other.- Greater than zero - This instance follows - otherin the sort order.
Equals(ObjectId)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ObjectId other)Parameters
- otherObjectId
- An object to compare with this object. 
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)Parameters
- objobject
- The object to compare with the current instance. 
Returns
- bool
- true if - objand this instance are the same type and represent the same value; otherwise, false.
FromBytes(byte[])
Computes a hash from a byte buffer.
public static ObjectId FromBytes(byte[] buffer)Parameters
- bufferbyte[]
- The byte buffer. 
Returns
- ObjectId
- The hash of the object. 
Exceptions
- ArgumentNullException
- buffer 
FromBytes(byte[], int, int)
Computes a hash from a byte buffer.
public static ObjectId FromBytes(byte[] buffer, int offset, int count)Parameters
- bufferbyte[]
- The byte buffer. 
- offsetint
- The offset into the buffer. 
- countint
- The number of bytes to read from the buffer starting at offset position. 
Returns
- ObjectId
- The hash of the object. 
Exceptions
- ArgumentNullException
- buffer 
FromObject<T>(T)
Computes a hash from an object using BinarySerializationWriter.
public static ObjectId FromObject<T>(T obj)Parameters
- objT
- The object. 
Returns
- ObjectId
- The hash of the object. 
Type Parameters
- T
FromObject<T>(T, out byte[])
Computes a hash from an object using BinarySerializationWriter.
public static ObjectId FromObject<T>(T obj, out byte[] buffer)Parameters
- objT
- The object. 
- bufferbyte[]
- The buffer containing the serialized object. 
Returns
- ObjectId
- The hash of the object. 
Type Parameters
- T
- The type of the object to serialize 
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()Returns
- int
- A 32-bit signed integer that is the hash code for this instance. 
New()
News this instance.
public static ObjectId New()Returns
- ObjectId
- ObjectId. 
ToGuid()
Gets a Guid from this object identifier.
public Guid ToGuid()Returns
- Guid
- Guid. 
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()Returns
- string
- The fully qualified type name. 
TryParse(string, out ObjectId)
Tries to parse an ObjectId from a string.
public static bool TryParse(string input, out ObjectId result)Parameters
Returns
- bool
- trueif parsing was successfull,- falseotherwise
Operators
operator ==(ObjectId, ObjectId)
Implements the ==.
public static bool operator ==(ObjectId left, ObjectId right)Parameters
Returns
- bool
- The result of the operator. 
explicit operator byte[](ObjectId)
public static explicit operator byte[](ObjectId objectId)Parameters
- objectIdObjectId
- The object id. 
Returns
- byte[]
- The result of the conversion. 
explicit operator ObjectId(Guid)
public static explicit operator ObjectId(Guid guid)Parameters
- guidGuid
Returns
operator !=(ObjectId, ObjectId)
Implements the !=.
public static bool operator !=(ObjectId left, ObjectId right)Parameters
Returns
- bool
- The result of the operator.