ObjectId Struct
Namespace: Stride.Core.StorageAssembly: Stride.Core.dll
A hash to uniquely identify data.
[DataContract("ObjectId")]
[Serializable]
[DataSerializer(typeof(ObjectId.Serializer))]
public struct ObjectId : IEquatable<ObjectId>, IComparable<ObjectId>
Constructors
ObjectId(Byte[])
Initializes a new instance of the ObjectId struct.
public ObjectId(byte[] hash)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | hash | The hash. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | hash |
System.InvalidOperationException | ObjectId value doesn't match expected size. |
ObjectId(UInt32, UInt32, UInt32, UInt32)
public ObjectId(uint hash1, uint hash2, uint hash3, uint hash4)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | hash1 | |
System.UInt32 | hash2 | |
System.UInt32 | hash3 | |
System.UInt32 | hash4 |
Fields
Empty
public static readonly ObjectId Empty
Field Value
Type | Description |
---|---|
ObjectId |
HashSize
public const int HashSize = 16
Field Value
Type | Description |
---|---|
System.Int32 |
HashStringLength
public const int HashStringLength = 32
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
Combine(ObjectId, ObjectId)
public static ObjectId Combine(ObjectId left, ObjectId right)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | left | |
ObjectId | right |
Returns
Type | Description |
---|---|
ObjectId |
Combine(ref ObjectId, ref ObjectId, out ObjectId)
public static void Combine(ref ObjectId left, ref ObjectId right, out ObjectId result)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | left | |
ObjectId | right | |
ObjectId | result |
CompareTo(ObjectId)
public int CompareTo(ObjectId other)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | other |
Returns
Type | Description |
---|---|
System.Int32 |
Equals(ObjectId)
public bool Equals(ObjectId other)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
FromBytes(Byte[])
Computes a hash from a byte buffer.
public static ObjectId FromBytes(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The byte buffer. |
Returns
Type | Description |
---|---|
ObjectId | The hash of the object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | buffer |
FromBytes(Byte[], Int32, Int32)
Computes a hash from a byte buffer.
public static ObjectId FromBytes(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The byte buffer. |
System.Int32 | offset | The offset into the buffer. |
System.Int32 | count | The number of bytes to read from the buffer starting at offset position. |
Returns
Type | Description |
---|---|
ObjectId | The hash of the object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | buffer |
FromObject<T>(T)
Computes a hash from an object using BinarySerializationWriter.
public static ObjectId FromObject<T>(T obj)
Parameters
Type | Name | Description |
---|---|---|
T | obj | The object. |
Returns
Type | Description |
---|---|
ObjectId | The hash of the object. |
Type Parameters
Name | Description |
---|---|
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
Type | Name | Description |
---|---|---|
T | obj | The object. |
System.Byte[] | buffer | The buffer containing the serialized object. |
Returns
Type | Description |
---|---|
ObjectId | The hash of the object. |
Type Parameters
Name | Description |
---|---|
T | The type of the object to serialize |
GetHashCode()
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
New()
News this instance.
public static ObjectId New()
Returns
Type | Description |
---|---|
ObjectId | ObjectId. |
ToGuid()
Gets a System.Guid from this object identifier.
public Guid ToGuid()
Returns
Type | Description |
---|---|
System.Guid | Guid. |
ToString()
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
TryParse(String, out ObjectId)
Tries to parse an ObjectId from a string.
public static bool TryParse(string input, out ObjectId result)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The input hexa string. |
ObjectId | result | The result ObjectId. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Operators
Equality(ObjectId, ObjectId)
Implements the ==.
public static bool operator ==(ObjectId left, ObjectId right)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | left | The left. |
ObjectId | right | The right. |
Returns
Type | Description |
---|---|
System.Boolean | The result of the operator. |
Explicit(ObjectId to Byte[])
Performs an explicit conversion from ObjectId to
public static explicit operator byte[](ObjectId objectId)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | objectId | The object id. |
Returns
Type | Description |
---|---|
System.Byte[] | The result of the conversion. |
Explicit(Guid to ObjectId)
public static explicit operator ObjectId(Guid guid)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | guid |
Returns
Type | Description |
---|---|
ObjectId |
Inequality(ObjectId, ObjectId)
Implements the !=.
public static bool operator !=(ObjectId left, ObjectId right)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | left | The left. |
ObjectId | right | The right. |
Returns
Type | Description |
---|---|
System.Boolean | The result of the operator. |