internal static TypeUsage ValidateNew( TypeUsage instanceType, IEnumerable <DbExpression> arguments, out DbExpressionList validArguments) { ArgumentValidation.CheckType(instanceType, nameof(instanceType)); CollectionType type = (CollectionType)null; if (TypeHelpers.TryGetEdmType <CollectionType>(instanceType, out type) && type != null) { TypeUsage elementType = type.TypeUsage; validArguments = ArgumentValidation.CreateExpressionList(arguments, nameof(arguments), true, (Action <DbExpression, int>)((exp, idx) => ArgumentValidation.RequireCompatibleType(exp, elementType, nameof(arguments), idx))); } else { List <TypeUsage> expectedTypes = ArgumentValidation.GetStructuralMemberTypes(instanceType); int pos = 0; validArguments = ArgumentValidation.CreateExpressionList(arguments, nameof(arguments), expectedTypes.Count, (Action <DbExpression, int>)((exp, idx) => ArgumentValidation.RequireCompatibleType(exp, expectedTypes[pos++], nameof(arguments), idx))); } return(instanceType); }