Re: ref vs. out: same at runtime, same/different at compiler time?
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Fri, 9 Mar 2007 07:43:02 -0000
Scott M. <s-mar@xxxxxxxxxxxxx> wrote:
1. you can't have
two methods that differ only in ref/out (presumably because they are
treated the same at run time),
No, at run time they are processed by the CLR according to different rules.
Could you point out those different rules in the CLI spec? I don't
believe there's any difference.
2, ref/out specifically are handled differently in
terms of when they need to be ininitialized, which is caught at
compile time.
Not quite. The reason they are treated the same at compile time is that
thier method signatures are the same and this is why you can't overload
them.
They're not treated the same. Changing "out" for "ref" or vice versa
changes the rules as to what you can and can't do.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- References:
- Prev by Date: Re: ref vs. out: same at runtime, same/different at compiler time?
- Next by Date: Re: removing escape character from a C# string
- Previous by thread: Re: ref vs. out: same at runtime, same/different at compiler time?
- Next by thread: Re: ref vs. out: same at runtime, same/different at compiler time?
- Index(es):
Relevant Pages
|