HI Nicholas,
Thanks for your mail. It has to do more with multicast delegates only. I
just spent some time on it:-
---------------
public delegate void Del(out string message);
public partial class OutDelegate : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Del handler = DelegateMethod;
string name;
handler(out name);
Response.Write(name);
}
private void DelegateMethod(out string message)
{
message = "Amit";
}
}
-----------
Now in the above example, if 'handler' is calling a number methods of the
same signature, the parameter 'name' will have different value everytime. So
for every method it calls, there has to be a sepearte parameter to store the
value returned by the method call. So, the documentation says to avoid using
out parameter in case of multicast delegate. I hope I have understood it
right :)
Thanks
AB
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eP**************@TK2MSFTNGP05.phx.gbl...
Amit,
Basically, the idea is that if you have an out parameter on a
delegate, you can't be sure of what that out parameter is (or ref parameters, for
that matter).
Because a delegate can have multiple functions that are called when it
is invoked, if every routine set the out parameter to something different,
then you would lose the value set by all of the other routines.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Amit Bansal (MCT, MCSD.NET)" <te*******@peoplewareindia.com> wrote in
message news:OH*************@TK2MSFTNGP05.phx.gbl... What is meant by this statement?
"Although the delegate can use an out parameter, it is not recommended
to use it with multicast event delegates because there is no way to know
which
delegate will be called."
regards
AB