本文整理汇总了C#中ImmutableDictionary.SetItem方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableDictionary.SetItem方法的具体用法?C# ImmutableDictionary.SetItem怎么用?C# ImmutableDictionary.SetItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableDictionary
的用法示例。
在下文中一共展示了ImmutableDictionary.SetItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSyntaxTreeToDeclarationMapAndTable
private static void AddSyntaxTreeToDeclarationMapAndTable(
SyntaxTree tree,
CSharpCompilationOptions options,
bool isSubmission,
ref ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMap,
ref DeclarationTable declTable,
ref bool referenceDirectivesChanged)
{
var lazyRoot = new Lazy<RootSingleNamespaceDeclaration>(() => DeclarationTreeBuilder.ForTree(tree, options.ScriptClassName ?? "", isSubmission));
declMap = declMap.SetItem(tree, lazyRoot);
declTable = declTable.AddRootDeclaration(lazyRoot);
referenceDirectivesChanged = referenceDirectivesChanged || tree.HasReferenceDirectives();
}
示例2: CollectDisposeMethodsCalledFromDispose
private static void CollectDisposeMethodsCalledFromDispose(InvocationExpressionSyntax invocationExpression,
SemanticModel semanticModel, INamedTypeSymbol disposableType,
ref ImmutableDictionary<INamedTypeSymbol, ImmutableHashSet<IMethodSymbol>> disposeMethodsCalledFromDispose)
{
var invokedMethod = semanticModel.GetSymbolInfo(invocationExpression).Symbol as IMethodSymbol;
if (invokedMethod == null ||
invokedMethod.Name != DisposeMethodName ||
!disposableType.Equals(invokedMethod.ContainingType))
{
return;
}
disposeMethodsCalledFromDispose =
disposeMethodsCalledFromDispose.SetItem(disposableType,
disposeMethodsCalledFromDispose[disposableType].Add(invokedMethod));
}
示例3: UpdateRuleMap
private static void UpdateRuleMap(ref ImmutableDictionary<string, bool> ruleMap, string data, bool enabled)
{
foreach (var current in data.Split(','))
{
ruleMap = ruleMap.SetItem(current, enabled);
}
}
示例4: BuildRuleMapFromOptions
private ImmutableDictionary<string, bool> BuildRuleMapFromOptions()
{
_ruleMap = ImmutableDictionary<string, bool>.Empty;
if (EnabledRules != null)
{
foreach (string rule in EnabledRules)
{
_ruleMap = _ruleMap.SetItem(rule, true);
}
}
if (DisabledRules != null)
{
foreach (string rule in DisabledRules)
{
_ruleMap = _ruleMap.SetItem(rule, false);
}
}
return _ruleMap;
}