Exemplo n.º 1
0
 public string Resolve(MetricsHelper <T> helper, string attribute)
 {
     if (!_attributes.TryGetValue(attribute, out Func <object, object?>?resolver))
     {
         if (attribute == "none")
         {
             return("");
         }
         return(helper.DefaultResolve(attribute) ?? throw new MissingFieldException(attribute));
     }
     return(resolver(helper)?.ToString() ?? "");
 }
Exemplo n.º 2
0
 public string Resolve(MetricsHelper <T> helper, string attribute)
 {
     if (!_attributes.TryGetValue(attribute, out MetricsHelper <T> .AttributeResolver.Resolver? resolver))
     {
         if (attribute.Equals("none"))
         {
             return("");
         }
         string?v = helper.DefaultResolve(attribute);
         if (v != null)
         {
             return(v);
         }
         throw new ArgumentOutOfRangeException(attribute);
     }
     return(resolver.ResolveImpl(helper));
 }