本文整理汇总了C#中ValueSource.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ValueSource.GetValue方法的具体用法?C# ValueSource.GetValue怎么用?C# ValueSource.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValueSource
的用法示例。
在下文中一共展示了ValueSource.GetValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static State Create(
ValueSource<Compilation> compilationSource,
ImmutableArray<ValueTuple<ProjectState, CompilationTranslationAction>> intermediateProjects)
{
Contract.ThrowIfNull(compilationSource);
Contract.ThrowIfNull(compilationSource.GetValue());
Contract.ThrowIfTrue(intermediateProjects.IsDefault);
// If we don't have any intermediate projects to process, just initialize our
// DeclarationState now.
return intermediateProjects.Length == 0
? (State)new FullDeclarationState(compilationSource)
: (State)new InProgressState(compilationSource, intermediateProjects);
}
示例2: TryGetOrAddMetadata
public bool TryGetOrAddMetadata(FileKey key, ValueSource<AssemblyMetadata> newMetadata, out AssemblyMetadata metadata)
{
lock (_gate)
{
if (TryGetMetadata_NoLock(key, out metadata))
{
return false;
}
EnsureCapacity_NoLock();
metadata = newMetadata.GetValue();
Contract.ThrowIfNull(metadata);
// don't use "Add" since key might already exist with already released metadata
_metadataCache[key] = newMetadata;
return true;
}
}
示例3: GetTextAndVersion
private static TextAndVersion GetTextAndVersion(
ValueSource<TreeAndVersion> newTreeSource, VersionStamp version, Encoding encoding, string filePath, CancellationToken cancellationToken)
{
var treeAndVersion = newTreeSource.GetValue(cancellationToken);
var text = treeAndVersion.Tree.GetRoot(cancellationToken).GetText(encoding);
return TextAndVersion.Create(text, version, filePath);
}
示例4: FinalState
public FinalState(ValueSource<Compilation> finalCompilationSource, bool hasSuccessfullyLoadedTransitively)
: base(finalCompilationSource, finalCompilationSource.GetValue().Clone().RemoveAllReferences())
{
_hasSuccessfullyLoadedTransitively = hasSuccessfullyLoadedTransitively;
}
示例5: FinalState
public FinalState(ValueSource<Compilation> finalCompilationSource)
: base(finalCompilationSource, finalCompilationSource.GetValue().Clone().RemoveAllReferences())
{
}
示例6: InProgressState
public InProgressState(
ValueSource<Compilation> inProgressCompilationSource,
ImmutableArray<ValueTuple<ProjectState, CompilationTranslationAction>> intermediateProjects)
: base(inProgressCompilationSource)
{
Contract.ThrowIfNull(inProgressCompilationSource);
Contract.ThrowIfNull(inProgressCompilationSource.GetValue());
Contract.ThrowIfTrue(intermediateProjects.IsDefault);
Contract.ThrowIfFalse(intermediateProjects.Length > 0);
this.IntermediateProjects = intermediateProjects;
}
示例7: FullDeclarationState
public FullDeclarationState(ValueSource<Compilation> declarationCompilation)
: base(declarationCompilation, declarationCompilation.GetValue().RemoveAllReferences())
{
}
示例8: IncrementallyParseTree
private static TreeAndVersion IncrementallyParseTree(
ValueSource<TreeAndVersion> oldTreeSource,
ValueSource<TextAndVersion> newTextSource,
CancellationToken cancellationToken)
{
try
{
using (Logger.LogBlock(FunctionId.Workspace_Document_State_IncrementallyParseSyntaxTree, cancellationToken))
{
var newTextAndVersion = newTextSource.GetValue(cancellationToken);
var oldTreeAndVersion = oldTreeSource.GetValue(cancellationToken);
return IncrementallyParse(newTextAndVersion, oldTreeAndVersion, cancellationToken);
}
}
catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
{
throw ExceptionUtilities.Unreachable;
}
}
示例9: FullyParseTree
private static TreeAndVersion FullyParseTree(
ValueSource<TextAndVersion> newTextSource,
ProjectId cacheKey,
string filePath,
ParseOptions options,
HostLanguageServices languageServices,
SolutionServices solutionServices,
PreservationMode mode,
CancellationToken cancellationToken)
{
using (Logger.LogBlock(FunctionId.Workspace_Document_State_FullyParseSyntaxTree, s_fullParseLog, filePath, mode, cancellationToken))
{
var textAndVersion = newTextSource.GetValue(cancellationToken);
return CreateTreeAndVersion(newTextSource, cacheKey, filePath, options, languageServices, mode, textAndVersion, cancellationToken);
}
}
示例10: FinalState
public FinalState(ValueSource<Compilation> finalCompilationSource, bool hasCompleteReferences)
: base(finalCompilationSource, finalCompilationSource.GetValue().Clone().RemoveAllReferences())
{
_hasCompleteReferences = hasCompleteReferences;
}
示例11: InProgressState
public InProgressState(
ValueSource<Compilation> inProgressCompilationSource,
ImmutableList<ValueTuple<ProjectState, CompilationTranslationAction>> intermediateProjects)
: base(inProgressCompilationSource)
{
Contract.ThrowIfNull(inProgressCompilationSource);
Contract.ThrowIfNull(inProgressCompilationSource.GetValue());
Contract.ThrowIfNull(intermediateProjects);
Contract.ThrowIfFalse(intermediateProjects.Count > 0);
this.IntermediateProjects = intermediateProjects;
}