public static Type GetPrimitiveElementType(Type collectionType) { var elementType = Utils.GetElementType(collectionType); if (elementType != null) { Utils.ValidatePrimitiveType(elementType); return(elementType); } throw new InvalidOperationException("Unable to determine element type"); }