Table of Contents

Struct ObjectId

Namespace
Stride.Core.Storage
Assembly
Stride.Core.dll

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

hash byte[]

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

hash1 uint
hash2 uint
hash3 uint
hash4 uint

Fields

Empty

public static readonly ObjectId Empty

Field Value

ObjectId

HashSize

public const int HashSize = 16

Field Value

int

HashStringLength

public const int HashStringLength = 32

Field Value

int

Methods

Combine(ObjectId, ObjectId)

public static ObjectId Combine(ObjectId left, ObjectId right)

Parameters

left ObjectId
right ObjectId

Returns

ObjectId

Combine(ref ObjectId, ref ObjectId, out ObjectId)

public static void Combine(ref ObjectId left, ref ObjectId right, out ObjectId result)

Parameters

left ObjectId
right ObjectId
result ObjectId

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

other ObjectId

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 other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in 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

other ObjectId

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

buffer byte[]

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

buffer byte[]

The byte buffer.

offset int

The offset into the buffer.

count int

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

obj T

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

obj T

The object.

buffer byte[]

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 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

input string

The input hexa string.

result ObjectId

The result ObjectId.

Returns

bool

true if parsing was successfull, false otherwise

Operators

operator ==(ObjectId, ObjectId)

Implements the ==.

public static bool operator ==(ObjectId left, ObjectId right)

Parameters

left ObjectId

The left.

right ObjectId

The right.

Returns

bool

The result of the operator.

explicit operator byte[](ObjectId)

Performs an explicit conversion from ObjectId to byte[].

public static explicit operator byte[](ObjectId objectId)

Parameters

objectId ObjectId

The object id.

Returns

byte[]

The result of the conversion.

explicit operator ObjectId(Guid)

public static explicit operator ObjectId(Guid guid)

Parameters

guid Guid

Returns

ObjectId

operator !=(ObjectId, ObjectId)

Implements the !=.

public static bool operator !=(ObjectId left, ObjectId right)

Parameters

left ObjectId

The left.

right ObjectId

The right.

Returns

bool

The result of the operator.