예제 #1
0
 public OptionInfo(BaseOptionAttribute attribute, PropertyInfo property)
 {
     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;
     _propertyWriter = new PropertyWriter(_property);
 }
예제 #2
0
 public bool MapValueItem(string item)
 {
     if (IsValueOptionDefined &&
         _valueOptionIndex < _valueOptionAttributeList.Count)
     {
         var valueOption = _valueOptionAttributeList[_valueOptionIndex++];
         var propertyWriter = new PropertyWriter(valueOption.Left);
         return ReflectionUtil.IsNullableType(propertyWriter.Property.PropertyType) ?
             propertyWriter.WriteNullable(item, _target) :
             propertyWriter.WriteScalar(item, _target);
     }
     return IsValueListDefined && AddValueItem(item);
 }