Generics (input - output) either dataset or typed dataset

G

Guest

Generics are new to me.

I want to write a function that accepts a generic parameter that is either a
dataset or a typed dataset. Have the function fill that object and return it.

Is this possilbe without casting it as an object and then ctype the returned
object to the desired type.

I thought generics will allow me to pass a dataset and have it filled or
pass a typed dataset and have it filled, using the same function.

Thank you for your help,

Karl
 
C

Claes Bergefall

I haven't really done much with generics, but something like this should
work:

Public Function FillDataSet(Of T As DataSet)(ByVal ds As T) As T
End Function

/claes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top