Click here to Skip to main content
15,920,508 members
Home / Discussions / C#
   

C#

 
AnswerRe: go to next Pin
Wendelius12-Jan-09 11:31
mentorWendelius12-Jan-09 11:31 
GeneralRe: go to next Pin
abu rakan12-Jan-09 11:50
abu rakan12-Jan-09 11:50 
GeneralRe: go to next Pin
Wendelius12-Jan-09 12:05
mentorWendelius12-Jan-09 12:05 
QuestionC# application to parse a sharepoint list Pin
pippyn12-Jan-09 8:14
pippyn12-Jan-09 8:14 
AnswerRe: C# application to parse a sharepoint list Pin
Not Active12-Jan-09 8:37
mentorNot Active12-Jan-09 8:37 
QuestionInsert a Page Break In word Using C# Pin
vikram_asv12-Jan-09 7:57
vikram_asv12-Jan-09 7:57 
AnswerRe: Insert a Page Break In word Using C# Pin
Jimmanuel12-Jan-09 9:38
Jimmanuel12-Jan-09 9:38 
QuestionGeneric event, or raise event based on generic type. Pin
DaveyM6912-Jan-09 7:23
professionalDaveyM6912-Jan-09 7:23 
After a discussion yesterday I'm playing around with the idea of a Singleton 'Notifier' class that can be subscribed to application wide. To make this more useable by allowing any type to be passed in event args, I figured generics would be a good idea. The genric TEventArgs<T> : EventArgs is set up and working fine

A generic class for the singleton is not possible as then the instance would be tied to a single type so I've got a generic method that in turn calls
protected virtual void OnNotify<T>(TEventArgs<T> e) { }

Because the class itself isn't generic, I can't figure out how to create a generic event
public event EventHandler<TEventArgs<T>> Notification;
as T isn't yet defined of course. Is there a way?

Failing that, is it possible to raise a specific event that has the type hard coded
(e.g. public event EventHandler<TEventArgs<int>> Notification)
based upon the type of T in the OnNotify method and use the e parameter?

I could be barking up the wrong tree here but I'm sure it should be possible!

Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

AnswerRe: Generic event, or raise event based on generic type. Pin
Gideon Engelberth12-Jan-09 8:46
Gideon Engelberth12-Jan-09 8:46 
GeneralRe: Generic event, or raise event based on generic type. Pin
DaveyM6912-Jan-09 8:52
professionalDaveyM6912-Jan-09 8:52 
GeneralRe: Generic event, or raise event based on generic type. Pin
Gideon Engelberth12-Jan-09 11:58
Gideon Engelberth12-Jan-09 11:58 
AnswerRe: Generic event, or raise event based on generic type. Pin
S. Senthil Kumar12-Jan-09 9:55
S. Senthil Kumar12-Jan-09 9:55 
GeneralRe: Generic event, or raise event based on generic type. Pin
DaveyM6912-Jan-09 10:07
professionalDaveyM6912-Jan-09 10:07 
GeneralRe: Generic event, or raise event based on generic type. Pin
Mark Churchill12-Jan-09 16:45
Mark Churchill12-Jan-09 16:45 
GeneralRe: Generic event, or raise event based on generic type. Pin
S. Senthil Kumar12-Jan-09 18:40
S. Senthil Kumar12-Jan-09 18:40 
GeneralRe: Generic event, or raise event based on generic type. Pin
Mark Churchill12-Jan-09 19:01
Mark Churchill12-Jan-09 19:01 
QuestionRe: Generic event, or raise event based on generic type. Pin
Wendelius12-Jan-09 11:16
mentorWendelius12-Jan-09 11:16 
AnswerRe: Generic event, or raise event based on generic type. [modified] Pin
DaveyM6912-Jan-09 22:58
professionalDaveyM6912-Jan-09 22:58 
GeneralRe: Generic event, or raise event based on generic type. Pin
Wendelius13-Jan-09 9:47
mentorWendelius13-Jan-09 9:47 
GeneralRe: Generic event, or raise event based on generic type. Pin
DaveyM6914-Jan-09 0:23
professionalDaveyM6914-Jan-09 0:23 
GeneralRe: Generic event, or raise event based on generic type. Pin
Wendelius14-Jan-09 2:30
mentorWendelius14-Jan-09 2:30 
GeneralRe: Generic event, or raise event based on generic type. Pin
DaveyM6914-Jan-09 3:25
professionalDaveyM6914-Jan-09 3:25 
GeneralRe: Generic event, or raise event based on generic type. Pin
Wendelius14-Jan-09 3:42
mentorWendelius14-Jan-09 3:42 
GeneralRe: Generic event, or raise event based on generic type. Pin
DaveyM6914-Jan-09 11:41
professionalDaveyM6914-Jan-09 11:41 
GeneralRe: Generic event, or raise event based on generic type. Pin
Wendelius14-Jan-09 11:59
mentorWendelius14-Jan-09 11:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.