Can someone explain this...
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Can someone explain this...

  1. #1
    Join Date
    Oct 2012

    Can someone explain this...

    VS2010 .net 3.5

            private void ReadDaqThreadProc()
                dThreadCallback tcb = new dThreadCallback(ReadDaq);
                while (flags.daqEnabled)
                        this.Invoke(tcb, new Object[] { });                }
                    catch (Exception e)
    This snippet is part of a multithreaded app. "tcb" is a delegate, ReadDaq is a function in the MainForm code, and ReadDaqThreadProc is in its own thread. I know what the code does but I dont know how. I'd like to understand how this works. The line in question is the invoke line. Is 'new Object[] {}' an argument list for ReadDaq?

  2. #2
    Join Date
    Jul 2012

    Re: Can someone explain this...

    The Invoke method takes as it's second parameter an array of objects containing the values for the method parameters (parameters for the method being invoked). If the method being invoked needs no parameters, you pass an empty object array. The syntax for creating an empty array of objects is:

    new object[] { }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This a survey!

HTML5 Development Center