public WithFormat <int> ConstantFormat <T>() { if (!_constantFormatters.TryGetValue(typeof(T), out var formatter)) { formatter = new WithConstantRepresentation(GetConstants <T>()); _constantFormatters.Add(typeof(T), formatter); } return(formatter); }
/// <summary> /// Create a YamlConstantSerializer using the given bitflag representation type. /// </summary> /// <param name="type"> /// The enum for which the constructors will be used to represent constant values. /// </param> /// </exception> public YamlConstantSerializer(Type type, WithConstantRepresentation formatter) : base(formatter) { _constantType = type; _formatter = formatter; }