Exemplo n.º 1
0
        public bool MapValueItem(string item)
        {
            if (IsValueOptionDefined &&
                _valueOptionIndex < _valueOptionAttributeList.Count)
            {
                var valueOption = _valueOptionAttributeList[_valueOptionIndex++];

                var propertyWriter = new PropertyWriter(valueOption.Left, _parsingCulture);

                return(ReflectionHelper.IsNullableType(propertyWriter.Property.PropertyType) ?
                       propertyWriter.WriteNullable(item, _target) :
                       propertyWriter.WriteScalar(item, _target));
            }

            return(IsValueListDefined && AddValueItem(item));
        }
Exemplo n.º 2
0
        public OptionInfo(BaseOptionAttribute attribute, PropertyInfo property, CultureInfo parsingCulture)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException("attribute", SR.ArgumentNullException_AttributeCannotBeNull);
            }

            if (property == null)
            {
                throw new ArgumentNullException("property", SR.ArgumentNullException_PropertyCannotBeNull);
            }

            _required             = attribute.Required;
            _shortName            = attribute.ShortName;
            _longName             = attribute.LongName;
            _mutuallyExclusiveSet = attribute.MutuallyExclusiveSet;
            _defaultValue         = attribute.DefaultValue;
            _hasDefaultValue      = attribute.HasDefaultValue;
            _attribute            = attribute;
            _property             = property;
            _parsingCulture       = parsingCulture;
            _propertyWriter       = new PropertyWriter(_property, _parsingCulture);
        }