本文整理汇总了C#中Microsoft.CodeAnalysis.Text.SourceText.GetChecksum方法的典型用法代码示例。如果您正苦于以下问题:C# SourceText.GetChecksum方法的具体用法?C# SourceText.GetChecksum怎么用?C# SourceText.GetChecksum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.Text.SourceText
的用法示例。
在下文中一共展示了SourceText.GetChecksum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyChecksum
private static void VerifyChecksum(SourceText text, ImmutableArray<byte> expectedChecksum)
{
var actualChecksum = text.GetChecksum();
Assert.Equal<byte>(expectedChecksum, actualChecksum);
}
示例2: FromSource
/// <summary>
/// Constructs a <see cref="EmbeddedText"/> for embedding the given <see cref="SourceText"/>.
/// </summary>
/// <param name="filePath">The file path (pre-normalization) to use in the PDB.</param>
/// <param name="text">The source text to embed.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="filePath"/> is null.
/// <paramref name="text"/> is null.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="filePath"/> empty.
/// <paramref name="text"/> cannot be embedded (see <see cref="SourceText.CanBeEmbedded"/>).
/// </exception>
public static EmbeddedText FromSource(string filePath, SourceText text)
{
ValidateFilePath(filePath);
if (text == null)
{
throw new ArgumentNullException(nameof(text));
}
if (!text.CanBeEmbedded)
{
throw new ArgumentException(CodeAnalysisResources.SourceTextCannotBeEmbedded, nameof(text));
}
if (!text.PrecomputedEmbeddedTextBlob.IsDefault)
{
return new EmbeddedText(filePath, text.GetChecksum(), text.ChecksumAlgorithm, text.PrecomputedEmbeddedTextBlob);
}
return new EmbeddedText(filePath, text.GetChecksum(), text.ChecksumAlgorithm, CreateBlob(text));
}