Call asynchronously

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Andrey Saplin (Saplin_at_discussions.microsoft.com)
Date: 08/06/04


Date: Fri, 6 Aug 2004 05:19:02 -0700

Hi,

For example, I've implemented a simple class with just one method:

public class A
{
        public void MyMethod1()
        {
                // implementation
        }
}

My questions relate to the implementation of this method.

1. How is it possible to understand whether this method has been called
syncrhonously or asynchronously (via delegate.BeginInvoke).
2. How is it possible to get an IAsyncResult associated with the current
asynchronous invocation.
3. How is it possible to intercept asynchronous invocation (initiated via
delegate.BeginInvoke), so it will use two additional methods instead, i.e.

public class A
{
        public void MyMethod1()
        {
                // implementation
        }

        public void MyMethod1Begin(parameters, IAsyncResult, ...)
        {
                // implementation
        }

        public void MyMethod1End(IAsyncResult)
        {
                // implementation
        }
}

Regards



Relevant Pages

  • Re: Referencing calling class
    ... Regards ... > Public Class ClassA ... > good job of explaining the How of OOP in VB.NET. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: ParentControlDesigner
    ... Imports System.ComponentModel.Design ... Public Class MyDesigner ... Private m_tbI As MyToolboxItem ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Unable to expose method using system.management.instrumentatio
    ... Best regards, ... Public Class InstanceClass ... Overloads Public Shared Function MainAs String) As Integer ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Setting To Header & TCPMon
    ... public class ws: System.Web.Services.WebService ... Regards, ... > attribute to the url when using a tool such as TCPMon. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • RE: Question about call base class constructor
    ... public class BaseClass ... public class DerivedClass: BaseClass ... Regards, ... "DreamTV" wrote: ...
    (microsoft.public.dotnet.languages.csharp)