473,414 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Invoking delegates

Hello,

I am reading the article
http://msdn.microsoft.com/msdnmag/is...asicInstincts/ , and, since
the sample code is VB.NET, I am wondering what the heck is the "Invoke"
method :) I used to think that I can simply directly call the delegate
type instance with parameters:

public class Executer
{
public delegate bool TestDelegateType(string strValue);

static bool TestDelegateMethod(string strValue)
{
Console.WriteLine("TestDelegateMethod got value:" + strValue);
return strValue == "ABC";
}

static void Main( )
{
TestDelegateType TestDelegate = new TestDelegateType(TestDelegateMethod);
// Simple call
bool result = TestDelegate("ABC");
Console.WriteLine("Call to TestDelegate returned: " + result);
Console.ReadLine();
}

}

As far as I know, I can not do anything like TestDelegate.Invoke("ABC",
null, null) in C#? So, apparently there is some syntax issue in VB.NET
preventing the direct execution of delegate, and it has to do it via Invoke
method? Please, clear this up for me, so I can have better understanding of
samples where there is no C# code.

Taking it further, what is the simplest C# syntax of launching the given
delegate asynchorously?

Thanks,

Pavils
Mar 29 '06 #1
0 871

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: david s | last post by:
I've got a combobox that I am getting updated data for in real time and need to clear out the values and reload it with the new data. I keep getting an error that I can't access the control...
0
by: Haxan | last post by:
Hi, I have an unmanaged application that converts a function pointer to a delegate and then pass this as a parameter(delegate) to a managed function which then invokes it. Currently Im able to...
6
by: DaTurk | last post by:
I know in a WinForm you can check if an Invoke is inquired and invoke a method on the main thread. But can you do this in a class? Can I call Invoke(someMethod) in my asynch event handler? And...
6
by: Charles Law | last post by:
I have a base class and derived classes that relate to a set of documents I process. e.g. DocBase, DocA, DocB, DocC. The processing of each document is handled in teh derived classes, as you might...
6
by: Charles Law | last post by:
I have a base class and derived classes that relate to a set of documents I process. e.g. DocBase, DocA, DocB, DocC. The processing of each document is handled in teh derived classes, as you might...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.