Delen via


SourceText.GetContentHash Method

Definition

Produces a hash of this SourceText based solely on the contents it contains. Two different SourceText instances that are ContentEquals(SourceText) will have the same content hash. Two instances of SourceText with different content are virtually certain to not have the same hash. This hash can be used for fingerprinting of text instances, but does not provide cryptographic guarantees.

public System.Collections.Immutable.ImmutableArray<byte> GetContentHash ();
member this.GetContentHash : unit -> System.Collections.Immutable.ImmutableArray<byte>
Public Function GetContentHash () As ImmutableArray(Of Byte)

Returns

Remarks

This hash is safe to use across platforms and across processes, as long as the same version of Roslyn is used in all those locations. As such, it is safe to use as a fast proxy for comparing text instances in different memory spaces. Different versions of Roslyn may produce different content hashes.

Applies to