I’m looking to constrain a type parameter to SqlDbType for a generic factory method. Here’s my attempt at the signature:
private static SqlParameter SqlParameterFactory<ValTYpe>(String
ParamName, SqlParamInOrOut Direction) where ValTYpe: SqlDbType
This gives the error: “Error 1 ‘System.Data.SqlDbType’ is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter.”
I sense it is doable, but it’s my sytax… any help would be appreciated.
SqlDbTypeis an enum. Pass it as a parameter