ContentHash

References
Contains information that is useful to uniquely identify an object. This object is immutable.

Constructors

ContentHash

#
protected ContentHash(ContentHash other)
Constructs a copy of a content hash.
other (ContentHash)The other content hash to copy.

Properties

ByteCount

#Since v6.0
[CLSCompliant(false)] public ulong ByteCount { get; }
Gets the length of the content, in bytes.

HashTime

#Since v6.0
public DateTime HashTime { get; }
Gets the hash time, rounded to seconds.

Sha1ContentHash

#Since v6.0
public byte[] Sha1ContentHash { get; }
Gets the 20-bytes long SHA1 hash of the content.

Sha1NameHash

#Since v6.0
public byte[] Sha1NameHash { get; }
Gets the 20-bytes long SHA1 hash of the name.

Methods

Clone

#Since v6.0
public ContentHash Clone()
Creates a copy of this content hash. Because content hash is immutable, this can be used as a deep copy.
A different instance of the same content hash.

CreateFromFile

#Since v6.0
public static ContentHash CreateFromFile(string path)
Creates a new ContentHash, representing the content of a file.
path (string)A path. This can be null and can refer to a non-existing path.

Equals

#Since v6.0
public bool Equals(ContentHash other)
Determines if another content hash has the same value.
other (ContentHash)The other content hash to compare.
True if the two hashes are equal.

Equals

#
public override bool Equals(object obj)
Determines if another object is a content hash with same value.
obj (object)The other content hash to compare.
True if the two hashes are equal.
Object.Equals

GetHashCode

#
public override int GetHashCode()
Gets an hash code for this content hash. Two equal content hashes have equal hash code. The other way around might not be true.
An hash code value.
Explicit

ICloneable.Clone

#Since v6.0

Operators

OperationResultDescription
ContentHash==ContentHashboolDetermines if two ContentHash instances are equal by value.
ContentHash!=ContentHashboolDetermines if two ContentHash instances are different by value.