473,505 Members | 15,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can we pass delegate as parameter ?

Hi Guys

Pls help me asap - Can we pass delegate as parameter ?

Thanx
Gopal Prabhakaran
Nov 15 '05 #1
3 54646
sure you can, thats how we can pass a method to the thread calls, or invoke.
"Gopal Prabhakaran" <pr*******@takescm.com> wrote in message
news:#I**************@TK2MSFTNGP10.phx.gbl...
Hi Guys

Pls help me asap - Can we pass delegate as parameter ?

Thanx
Gopal Prabhakaran

Nov 15 '05 #2
Pls tell me how to do?
r give some sample codes?
r tell me some sites to learn?

Thanx
Prabhakaran.G
<di********@discussion.microsoft.com> wrote in message
news:#s**************@TK2MSFTNGP11.phx.gbl...
sure you can, thats how we can pass a method to the thread calls, or invoke.

"Gopal Prabhakaran" <pr*******@takescm.com> wrote in message
news:#I**************@TK2MSFTNGP10.phx.gbl...
Hi Guys

Pls help me asap - Can we pass delegate as parameter ?

Thanx
Gopal Prabhakaran


Nov 15 '05 #3
Here is a simple example of passing a delegate to a function.

class DelegateTest
{
private delegate void MyDelegate();

public static void Main(string[] args)
{
MyDelegate d = new MyDelegate(Test);
CallDelegate(d);
}

private static void CallDelegate(MyDelegate d)
{
d(); // call the delegate that was passed in
}

private static void Test()
{
Console.WriteLine("Hello, world!");
}
}

P.

--
www.CL4.org
Nov 15 '05 #4

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

Similar topics

0
1336
by: Pravin | last post by:
I have following architecture. c# code --> managed c++ code (wrapper) -> c wrapper code to third party tool --> third party tool written in c. c# code sends some data and a delegate to c++...
9
11336
by: Martoon | last post by:
I want to instantiate an STL map with my own compare function, and I want to pass a parameter to the compare function that will be stored and used for all comparisons in that map instance. As an...
2
20414
by: Dud Bug | last post by:
I have a query in an Access db that prompts the user for info. (e.g. a primary key representing a company) before compiling the relevant table of results. This works fine in Access but I want to use...
3
2400
by: Angus | last post by:
I have a program which when downloaded from a server downloads another program from the same web server and then configures the downloaded program. The trouble is I have to hard code in the...
3
7334
by: John Dalberg | last post by:
I have seen examples for List<T>.FindAll(findthis)where findthis is a predicate. How do I pass a parameter to this predicate so that I have different values to search for? I don't want to use...
2
8495
by: | last post by:
I have a gridview with a textbox in an ItemTemplate, as below. The OnTextChanged event fires okay but how do I pass a parameter to it, I get an error when I try "OnTextChanged(""SomeData"")". I...
6
2835
by: =?Utf-8?B?emlubw==?= | last post by:
I'm trying to pass a delegate as parameter but the code below does not compile. It display an error: 'AddressOf operand must the name of a method(without parantheses)' How can I make it work. ...
6
2058
by: Max | last post by:
i have a event bind function like this(though it is not so robust): bind$=function(o,evt,fn,cb){ var aE='attachEvent'; var aEL='addEventListener'; if(!o&&o){ return o(evt,fn,!!cb); } return...
1
9306
by: Jorge | last post by:
On Oct 23, 10:36 am, Tuxedo <tux...@mailinator.comwrote: Yes: function first_function (PARAMETER) { preload_image = new Image(800,600); preload_image.onload = function () {...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
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...
1
5028
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
4699
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...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.