using System; using System.Collections.Generic; namespace Luticate2.Auth.Business.Serializers.PartialJson { internal class LuSerializerContext { private readonly Func shouldSerialize; private readonly Dictionary cache = new Dictionary(); public LuSerializerContext(Func shouldSerialize) { this.shouldSerialize = shouldSerialize; } public bool ShouldSerialize(string path) { if (this.cache.ContainsKey(path)) { return this.cache[path]; } var result = this.shouldSerialize(path); this.cache.Add(path, result); return result; } } }