/// <summary>
 /// Creates a builder for a custom ResultConverter.
 /// Call builder.With(...) to define member conversions, then builder.Compile().
 /// </summary>
 /// <param name="withDefaultConversions">If true, member conversions will fall back to default conversion when no custom conversion is defined.</param>
 public Builder(bool withDefaultConversions = true)
 {
     _withDefaults     = withDefaultConversions;
     _assignerBuilders = typeof(TResult)
                         .FieldsOrderedByDeclaration()
                         .Where(CanSetValue)
                         .Select(m => ValueAssigner.Build <TResult>(m))
                         .ToList();
 }
            private ValueAssigner.IBuilder <TResult> GetOrAdd(MemberInfo member)
            {
                var builder = _assignerBuilders.Find(cm => cm.Member == member);

                if (builder == null)
                {
                    builder = ValueAssigner.Build <TResult>(member);
                    _assignerBuilders.Add(builder);
                }
                return(builder);
            }
 /// <summary>
 /// Creates a builder for a custom ResultConverter.
 /// Call builder.With(...) to define conversions, then builder.Compile().
 /// </summary>
 /// <param name="withDefaultConversions">If true, conversion will fall back to default conversion when no custom conversion is defined.</param>
 public ScalarBuilder(bool withDefaultConversions = true)
 {
     _withDefaults = withDefaultConversions;
     _builder      = ValueAssigner.Build <TResult>();
 }