Пример #1
0
            public Argument(CommandLineArgumentAttribute attribute, FieldInfo field, ErrorReporter reporter)
            {
                this.longName          = CommandLineArgumentParser.LongName(attribute, field);
                this.explicitShortName = CommandLineArgumentParser.ExplicitShortName(attribute);
                this.shortName         = CommandLineArgumentParser.ShortName(attribute, field);
                this.elementType       = ElementType(field);
                this.flags             = Flags(attribute, field);
                this.field             = field;
                this.seenValue         = false;
                this.reporter          = reporter;
                this.isDefault         = attribute != null && attribute is DefaultCommandLineArgumentAttribute;
                this.description       = attribute.Description;

                if (IsCollection)
                {
                    this.collectionValues = new ArrayList();
                }

                Debug.Assert(this.longName != null && this.longName.Length > 0);
                if (IsCollection && !AllowMultiple)
                {
                    ThrowError("Collection arguments must have allow multiple");
                }
                Debug.Assert(!Unique || IsCollection, "Unique only applicable to collection arguments");
                Debug.Assert(IsValidElementType(Type) ||
                             IsCollectionType(Type));
                Debug.Assert((IsCollection && IsValidElementType(elementType)) ||
                             (!IsCollection && elementType == null));
            }