public void AddOrdinalArgument(MemberInfo member) { if (OrdinalArguments.Any(m => m.GetDeclaredType().GetGenericIEnumerable() != null)) { throw new InvalidOperationException(Properties.Resources.OnlyLastOridnalArgumentCollectionMessage); } GetOrCreateMemberBindingDefinition(member); OrdinalArguments.Add(member); }
private void EnsureCorrectNumberOfOrdinalArguments(IEnumerable <string> ordinalArgs) { if (OrdinalArguments.Any()) { if (OrdinalArguments.Count == ordinalArgs.Count()) { return; } var hasCollection = OrdinalArguments.Last().GetDeclaredType().GetGenericIEnumerable() != null; if (hasCollection && ordinalArgs.Count() >= OrdinalArguments.Count) { return; } throw new InvalidOperationException(string.Format(Properties.Resources.IncorrectNumberOfOrdinalArgumentsMessage, OrdinalArguments.Count)); } }