public static XmlObjectContractBuilder <T> SetProperty <T, TProperty>(
     this XmlObjectContractBuilder <T> builder,
     Expression <Func <T, TProperty> > expression,
     XmlName name = null,
     XmlMappingType mappingType = XmlMappingType.Element)
 {
     return(SetProperty(builder, expression, x => x.SetName(name).SetMappingType(mappingType)));
 }
        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(nameof(build));
            }

            var property = XmlPropertyBuilder.Create <T, TProperty>(expression);

            build(property);

            if (builder.Properties == null)
            {
                builder.Properties = new XmlPropertyBuilderCollection();
            }

            builder.Properties.Set(property);

            return(builder);
        }