本文整理汇总了C#中Microsoft.CodeAnalysis.DocumentState.TryGetTextVersion方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentState.TryGetTextVersion方法的具体用法?C# DocumentState.TryGetTextVersion怎么用?C# DocumentState.TryGetTextVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.DocumentState
的用法示例。
在下文中一共展示了DocumentState.TryGetTextVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLatestDependentVersions
private void GetLatestDependentVersions(
ImmutableDictionary<DocumentId, DocumentState> newDocumentStates,
DocumentState oldDocument, DocumentState newDocument,
bool recalculateDependentVersions, bool textChanged,
out AsyncLazy<VersionStamp> dependentDocumentVersion, out AsyncLazy<VersionStamp> dependentSemanticVersion)
{
var recalculateDocumentVersion = false;
var recalculateSemanticVersion = false;
if (recalculateDependentVersions)
{
VersionStamp oldVersion;
if (oldDocument.TryGetTextVersion(out oldVersion))
{
VersionStamp documentVersion;
if (!this.lazyLatestDocumentVersion.TryGetValue(out documentVersion) || documentVersion == oldVersion)
{
recalculateDocumentVersion = true;
}
VersionStamp semanticVersion;
if (!this.lazyLatestDocumentTopLevelChangeVersion.TryGetValue(out semanticVersion) || semanticVersion == oldVersion)
{
recalculateSemanticVersion = true;
}
}
}
dependentDocumentVersion = recalculateDocumentVersion ?
new AsyncLazy<VersionStamp>(this.ComputeLatestDocumentVersionAsync, cacheResult: true) :
textChanged ?
new AsyncLazy<VersionStamp>(newDocument.GetTextVersionAsync, cacheResult: true) :
this.lazyLatestDocumentVersion;
dependentSemanticVersion = recalculateSemanticVersion ?
new AsyncLazy<VersionStamp>(c => ComputeLatestDocumentTopLevelChangeVersionAsync(newDocumentStates, c), cacheResult: true) :
textChanged ?
CreateLazyLatestDocumentTopLevelChangeVersion(newDocument, newDocumentStates) :
this.lazyLatestDocumentTopLevelChangeVersion;
}