By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 943 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

TItem, TData, etc? Generics

P: n/a
How do I declare an object to accept a TItem?

Also where is the documentation on TItem/TData/etc?
Here's the object:

Public Class DataEventArgs(Of TData)
Inherits EventArgs

Private innerData As TData

Here's the delgate which I want to pass a TItem

Public Delegate Sub EventListener(ByVal Sender As Object, ByVal e As
DataEventArgs(Of TItem)) <-- TItem doesn't work.
Nov 9 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Spam Catcher" <sp**********@rogers.comschrieb:
How do I declare an object to accept a TItem?

Also where is the documentation on TItem/TData/etc?
Here's the object:

Public Class DataEventArgs(Of TData)
Inherits EventArgs

Private innerData As TData

Here's the delgate which I want to pass a TItem

Public Delegate Sub EventListener(ByVal Sender As Object, ByVal e As
DataEventArgs(Of TItem)) <-- TItem doesn't work.
This does not work because 'TItem' does not seem to be a generic type
parameter of 'DataEventArgs(Of TData)'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 9 '06 #2

P: n/a
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in
news:Om*************@TK2MSFTNGP04.phx.gbl:
This does not work because 'TItem' does not seem to be a generic type
parameter of 'DataEventArgs(Of TData)'.
Hi,

I solved the issue - I had the syntax wrong in using generics.

Thanks :)
Nov 10 '06 #3

P: n/a
Spam,
Public Delegate Sub EventListener(ByVal Sender As Object, ByVal e As
DataEventArgs(Of TItem)) <-- TItem doesn't work.
Depending on where you are trying to define EventListener you may need to
make the Delegate itself generic:

Public Delegate Sub EventListener(Of TItem)(ByVal sender As Object,
ByVal e As DataEventArgs(Of TItem))
Although I normally use EventHandler(Of T) then pass DataEventArgs(Of TItem)
as T.

Public Event Something As EventHandler(Of DataEventArgs(Of Whatever))
--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Spam Catcher" <sp**********@rogers.comwrote in message
news:Xn**********************************@127.0.0. 1...
How do I declare an object to accept a TItem?

Also where is the documentation on TItem/TData/etc?
Here's the object:

Public Class DataEventArgs(Of TData)
Inherits EventArgs

Private innerData As TData

Here's the delgate which I want to pass a TItem

Public Delegate Sub EventListener(ByVal Sender As Object, ByVal e As
DataEventArgs(Of TItem)) <-- TItem doesn't work.
Nov 12 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.