问题
I'm trying to validate a multidimensional array of inputs. I need to verify data types before they're sent to a prepared statement.
I'm making a Function
that can be used to check data types of a multidimensional array received from a WebMethod
ajax call, taking a multidimensional array as a parameter and a list of Type
s as another to check the columns against.
I'm trying to do, for example,
Dim columnTypes = New List(Of Type) from {Integer, Integer, String, String}
but Visual Studio 2010 keeps reporting '.' expected
.
How can this be done properly?
回答1:
Type literals needs to be wrapped into GetType:
Dim columnTypes = New List(Of Type) From {GetType(Integer), GetType(Integer),
GetType(String), GetType(String)}
来源:https://stackoverflow.com/questions/17557512/how-to-fill-listof-type