public PrintingConfig <TOwner> SetAlternateSerialize <TPropType>(Func <TPropType, string> serializer) { return(new PrintingConfig <TOwner>(this) { alternateTypeSerializers = alternateTypeSerializers.AddOrSet(typeof(TPropType), x => serializer((TPropType)x)) }); }
public PrintingConfig <TOwner> SetTrimming( Expression <Func <TOwner, string> > memberSelector, int maxLength) { var selectedMember = ((MemberExpression)memberSelector.Body).Member; return(new PrintingConfig <TOwner>(this) { memberLengths = memberLengths.AddOrSet(selectedMember, maxLength) }); }
public PrintingConfig <TOwner> SetAlternateSerialize <TPropType>( Expression <Func <TOwner, TPropType> > memberSelector, Func <TPropType, string> alternateSerializer) { var selectedMember = ((MemberExpression)memberSelector.Body).Member; return(new PrintingConfig <TOwner>(this) { alternateMemberSerializers = alternateMemberSerializers.AddOrSet(selectedMember, x => alternateSerializer((TPropType)x)) }); }