Hi all,
I m working on project i which i have to make one method which accept multiple parameter of the Generic class. But the problem is while declaring the function.
Let me clear the vision.
Now I want to make one method in another class that Insert the record in DB using function having ParamArray of Generic Class object.Code:Class SqlParam(Of T) Public obj As T Sub New(ByVal parameterName As String, ByVal type As System.Data.SqlDbType, ByVal size As Integer, ByVal value As T, Optional ByVal isNullable As Boolean = False) 'Action End Sub End Class
Like
What should i defined there inplace of Object maked red. Bec'z I want to Achieve thisCode:Class SqlHelper Public Sub Insert(ByVal ParamArray parameters() As SqlParam(Of Object)) 'Action Here End Sub End Class
I know there are other methods but I am using generic class bec'z i want type safety. Hope you can focus on this.Code:Dim objSql As New SqlHelper() objSql.Insert(New SqlParam(Of String)("@ID", SqlDbType.VarChar, 1000, "Coool"), New SqlParam(Of Integer)("@Total", SqlDbType.Int, 50, 23))
Thanks in Advance.




Reply With Quote