SourceText.GetContentHash Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.