ja, i think I do understand this a little better now. Thanks
>>ooohhhh keyyyyyy
>>
>>Can Someone explain that one to me?
>>
>>You are correct the design plattform does not show an error anymore. I'll have to test the whole code now to see if I run into any other errors.
>>
>>But I don't understand that.
>>
>>I know that the "(of T)" expects a type (such as integer, varchar, etc...
>>
>>since "T" is not a type I understood the occurance of the error - just didn't know how to fix it.
>>
>>But all you did was to add another "(Of T)" - now i am defently lost.
>>
>>I was already way lost before - but now ... lol
>
>You're right that "(Of T)" in VB or "< T >" in C#, tells the the compiler to expect a type. However, you hadn't told the method to expect the type, and it was only "mentioned" in the parameter list, so the compiler didn't know what to expect and thought that type T was undefined. It seems a bit redundant to have to specify T in both places and a bit silly that the compiler couldn't infer that, but that's the way it is with generics.
>
>So, the first use of "(Of T)" tells the method to expect a type T, whereas the second use of it, tells the method which parameter is going to make use of the type T:
>
>Public Shared Function ToDataTable(Of T)(data As IList(Of T)) As DataTable
>
>>Thank you much for that help!
>
>You're welcome! I hope the above explanation makes sense. I might have caught the missing "(Of T)" earlier if I knew VB syntax better. <g>
>
>~~Bonnie
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only