Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help me about OCR Pin
Dave Kreskowiak28-May-09 2:03
mveDave Kreskowiak28-May-09 2:03 
AnswerRe: Help me about OCR Pin
Christian Graus25-May-09 18:29
protectorChristian Graus25-May-09 18:29 
GeneralRe: Help me about OCR Pin
Phoiphapham27-May-09 18:29
Phoiphapham27-May-09 18:29 
QuestionCut, Copy Paste TreeNodes Pin
Rafone25-May-09 14:35
Rafone25-May-09 14:35 
AnswerRe: Cut, Copy Paste TreeNodes Pin
Mycroft Holmes25-May-09 15:57
professionalMycroft Holmes25-May-09 15:57 
GeneralRe: Cut, Copy Paste TreeNodes Pin
Rafone26-May-09 2:47
Rafone26-May-09 2:47 
Questionanybody knows Tools for veiw problems with final code Pin
DVD_RR25-May-09 13:29
DVD_RR25-May-09 13:29 
QuestionSubscribe to event on all instances in array Pin
DaveyM6925-May-09 12:58
professionalDaveyM6925-May-09 12:58 
I have a class Input that has a static property Input[] Devices.

Instead of the user having to iterate over the array and subscribe to an event in each instance, I want to provide a mechanism where they can do it in one shot.

This works, but I wondered if there was a better way?
public class Input
{
    public event EventHandler<ConnectedEventArgs> Connected;

    public static Input[] Devices
    {
        get
        {
            // ...
        }
    }

    public static void SubscribeToAllConnected(EventHandler<ConnectedEventArgs> multicastDelegate)
    {
        foreach (Input device in Devices)
            device.Connected += multicastDelegate;
    }

    public static void UnsubscribeToAllConnected(EventHandler<ConnectedEventArgs> multicastDelegate)
    {
        foreach (Input device in Devices)
            device.Connected -= multicastDelegate;
    }
}


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)
Why are you using VB6? Do you hate yourself? (Christian Graus)

AnswerRe: Subscribe to event on all instances in array Pin
N a v a n e e t h25-May-09 17:29
N a v a n e e t h25-May-09 17:29 
GeneralRe: Subscribe to event on all instances in array Pin
DaveyM6925-May-09 23:03
professionalDaveyM6925-May-09 23:03 
QuestionTo stop keys Pin
ammoti25-May-09 11:51
ammoti25-May-09 11:51 
AnswerRe: To stop keys Pin
_Maxxx_25-May-09 12:12
professional_Maxxx_25-May-09 12:12 
AnswerRe: To stop keys Pin
EliottA25-May-09 12:14
EliottA25-May-09 12:14 
GeneralRe: To stop keys Pin
ammoti25-May-09 12:23
ammoti25-May-09 12:23 
GeneralRe: To stop keys Pin
EliottA25-May-09 12:38
EliottA25-May-09 12:38 
GeneralRe: To stop keys Pin
ammoti25-May-09 12:51
ammoti25-May-09 12:51 
GeneralRe: To stop keys Pin
EliottA25-May-09 12:51
EliottA25-May-09 12:51 
GeneralRe: To stop keys Pin
Dave Kreskowiak25-May-09 14:42
mveDave Kreskowiak25-May-09 14:42 
QuestionLooking for help getting started... Pin
Are Jay25-May-09 11:50
Are Jay25-May-09 11:50 
AnswerRe: Looking for help getting started... Pin
_Maxxx_25-May-09 12:14
professional_Maxxx_25-May-09 12:14 
GeneralRe: Looking for help getting started... Pin
Are Jay25-May-09 14:34
Are Jay25-May-09 14:34 
GeneralRe: Looking for help getting started... Pin
Dave Kreskowiak25-May-09 14:40
mveDave Kreskowiak25-May-09 14:40 
AnswerRe: Looking for help getting started... Pin
Dave Kreskowiak25-May-09 14:38
mveDave Kreskowiak25-May-09 14:38 
GeneralRe: Looking for help getting started... Pin
Are Jay25-May-09 15:51
Are Jay25-May-09 15:51 
GeneralRe: Looking for help getting started... Pin
Dave Kreskowiak25-May-09 17:51
mveDave Kreskowiak25-May-09 17:51 

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.