public bool AddDefinition(string name, bool isOptional, IValidateParameters validator)
        {
            // get last parameter
            ParameterDefinition lastParameter = (parameters.Count != 0) ? parameters[parameters.Count - 1] : null;

            // if last parameter is optional then mandatory parameters cannot be accepted
            if ((lastParameter != null) && (lastParameter.IsOptional) && !isOptional)
            {
            errorMessage = string.Format("Parameter '{0}' cannot be mandatory because parameter {1} is optional", name, lastParameter.Name);
            return false;
            }

            // keep parameter definition
            parameters.Add(new ParameterDefinition(name, isOptional, validator));
            return true;
        }
 public bool AddDefinition(string name, IValidateParameters validator)
 {
     return AddDefinition(name, false, validator);
 }
 public ParameterDefinition(string name, bool isOptional, IValidateParameters validator)
 {
     this.name = name;
     this.isOptional = isOptional;
     this.validator = validator;
 }