|
![](/i/fill.gif) |
Warp wrote:
> No. What I said was that I don't see usefulness IN THIS CASE. The
> difference is practically nonexistent. It's only in reordering of
> names.
It lets code generation tools (and LINQ) generate code in one pattern
(distinguished caller syntax) for both methods defined on the class and
methods defined outside the class.
It gives you the same benefit that having the name "operator<" available
does. If you want to do a sort in C of integers, you call
qsort(myArray, myCompare);
int myCompare(int a, int b) {return a < b;}
In C++ you call
qsort(myArray, operator< );
or some such syntax, but without the need to have a specifically named
function just to wrap up the < operator.
Plus, of course, it lets the same member-syntax function mean different
things in different places in your code. Here, xyz.Select(...) means one
function, while there xyz.Select(...) means a different function. This is
important when "here" and "there" are two compiled libraries from two
different sources and you're automatically generating the code.
--
Darren New, San Diego CA, USA (PST)
"Ouch ouch ouch!"
"What's wrong? Noodles too hot?"
"No, I have Chopstick Tunnel Syndrome."
Post a reply to this message
|
![](/i/fill.gif) |