private static void AddParentToChild(string fromTag, string toTag, TagRule rule, Dictionary <string, ImmutableDictionary <string, TagRule> > map) { if (!map.TryGetValue(fromTag, out var parents)) { parents = ImmutableDictionary <string, TagRule> .Empty; } if (!parents.ContainsKey(toTag)) { map[fromTag] = parents.Add(toTag, rule); } }
public static RuleResult <TResult> Create <TResult>(TagRule rule, TResult result) => new RuleResult <TResult>(new[] { rule }, result);