internal FixedWidthField(FixedWidthFieldAttribute attribute)
 {
     Debug.Assert(attribute?.Field != null);
     Length       = attribute.Field.Length;
     Alignment    = attribute.Field.Alignment;
     PadCharacter = attribute.Field.PadCharacter;
     TrimField    = attribute.Field.TrimField;
     Skip         = attribute.Field.Skip;
 }
Beispiel #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="field">The information for this field.</param>
        /// <param name="attribute">The field's <see cref="FixedWidthFieldAttribute"/> attribute.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public MemberDescriptor(FieldInfo field, FixedWidthFieldAttribute attribute)
            : base(attribute)
        {
            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }

            Member    = new FieldMember(field);
            Converter = GetConverter(attribute.ConverterType);
            Debug.Assert(Converter != null);
        }
Beispiel #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="property">The information for this property.</param>
        /// <param name="attribute">The property's <see cref="FixedWidthFieldAttribute"/> attribute.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public MemberDescriptor(PropertyInfo property, FixedWidthFieldAttribute attribute)
            : base(attribute)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }

            Member    = new PropertyMember(property);
            Converter = GetConverter(attribute.ConverterType);
            Debug.Assert(Converter != null);
        }