473,386 Members | 1,694 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,386 software developers and data experts.

About to get the return value from a method called by a delegate

Hi all,
I had made a method that will return a string type value. And I invoke this
method in a string type delegate .And how can I get the return value when
the method finish processing.
for example:
public string A()
{
...
return A_value;
}
public class C_A
{
delegate string delegate_A;
public C_A()
{
delegate_A D_A=new deleagate_A(A);
D_A.BeginInvoke(null,null);
}
}

Like this the method has a string type return value, and when I call it in a
delegate ,how can I get the return value from the method A?
Nov 16 '05 #1
1 1085
These articles should help

http://www.ondotnet.com/pub/a/dotnet...delegates.html
http://msdn.microsoft.com/library/de...mingsample.asp

The crux is that when you call endinvoke on the delegate you will get
the return value. The various ways of calling EndInvoke are described in
the articles above. Hope that clears it up.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Jet Leung wrote:
Hi all,
I had made a method that will return a string type value. And I invoke this
method in a string type delegate .And how can I get the return value when
the method finish processing.
for example:
public string A()
{
...
return A_value;
}
public class C_A
{
delegate string delegate_A;
public C_A()
{
delegate_A D_A=new deleagate_A(A);
D_A.BeginInvoke(null,null);
}
}

Like this the method has a string type return value, and when I call it in a
delegate ,how can I get the return value from the method A?

Nov 16 '05 #2

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

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
2
by: Ruediger Klaehn | last post by:
I have written an arithmetic expression compiler. Now that it is finished I would like to give it a nice interface. Currently I have this interface: delegate double Function(double x); class...
3
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
12
by: Michael S | last post by:
Why do people spend so much time writing complex generic types? for fun? to learn? for use? I think of generics like I do about operator overloading. Great to have as a language-feature, as...
7
by: tony | last post by:
Hello! What is the differens if I use event handler onSizeChanged compare to using the other event handler MeltPracForm_SizeChanged. I see both as event handler is that right? I catch the event...
1
by: Morgan Cheng | last post by:
Asynchronous method model generally has a callback delegate as argument. The delegate will be called when some WaitHandle is set or time out. And, one more argument is used as state object to...
14
by: =?Utf-8?B?QmVu?= | last post by:
Hi all, I'm trying to understand the concept of returning functions from the enclosing functions. This idea is new to me and I don't understand when and why I would need to use it. Can someone...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
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...

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.