public static XmlObjectContractBuilder <T> SetProperty <T, TProperty>( this XmlObjectContractBuilder <T> builder, Expression <Func <T, TProperty> > expression, Action <XmlPropertyBuilder> build) { if (build == null) { throw new ArgumentNullException("build"); } var property = XmlPropertyBuilder.Create <T, TProperty>(expression); build(property); if (builder.Properties == null) { builder.Properties = new XmlPropertyBuilderCollection(); } builder.Properties.Set(property); return(builder); }
public static TBuilder SetProperty <TBuilder>( this TBuilder builder, string propertyName, Action <XmlPropertyBuilder> build) where TBuilder : XmlObjectContractBuilder { if (build == null) { throw new ArgumentNullException("build"); } var property = XmlPropertyBuilder.Create(builder.ValueType, propertyName); build(property); if (builder.Properties == null) { builder.Properties = new XmlPropertyBuilderCollection(); } builder.Properties.Set(property); return(builder); }