Exemple #1
0
        private Func <GetStringRequest, string> findConverter(GetStringRequest request)
        {
            if (request.PropertyType.IsNullable())
            {
                if (request.RawValue == null)
                {
                    return(r => string.Empty);
                }

                return(findConverter(request.GetRequestForNullableType()));
            }

            if (request.PropertyType.IsArray)
            {
                if (request.RawValue == null)
                {
                    return(r => string.Empty);
                }

                return(r =>
                {
                    if (r.RawValue == null)
                    {
                        return string.Empty;
                    }

                    return r.RawValue.As <Array>().OfType <object>().Select(GetString).Join(", ");
                });
            }

            StringifierStrategy strategy = _strategies.FirstOrDefault(x => x.Matches(request));

            return(strategy == null ? toString : strategy.StringFunction);
        }
Exemple #2
0
 public void AddStrategy(StringifierStrategy strategy)
 {
     _strategies.Add(strategy);
 }
Exemple #3
0
 public void AddStrategy(StringifierStrategy strategy)
 {
     _strategies.Add(strategy);
 }