I'm reading Professional C# (Wrox) and stumbled across:
"Some features are supported by.NET but not by C#, and you might be surprised
to learn that some features of the C# language are not supported by .NET
(for example, some instances of operator overloading)!"
How can some features be supported by C# and not .NET? Are there other features
than operator overloading and could someone please supply an example?
/ Fister
Marc Gravell - 31 May 2007 22:32 GMT
As a suggestion - the string concatenation operator is provided by the
C# compiler, not the String class; this allows "a" + "b" + "c" + "d"
etc to be a single call (to String.Concat), not successive add
operations.
This might also refer to CLS compliance?
Marc
Marc Gravell - 31 May 2007 22:33 GMT
Of course, re my last post, you could argue that this *is* supported,
precisely by calling string.Concat()...
Marc
Jon Skeet [C# MVP] - 31 May 2007 22:37 GMT
> Of course, re my last post, you could argue that this *is* supported,
> precisely by calling string.Concat()...
It's just not supported as an addition operator on the string type.
Some of the nullable conversions may be similar - not sure.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nicholas Paldino [.NET/C# MVP] - 31 May 2007 22:35 GMT
Fister,
One can interpret the first statement:
Some features are supported by.NET but not by C#
To mean that features that you see in the language are not necessarily
implemented in the language, but rather, in the framework. In this case, I
would say the type aliases, like int, string, etc, etc. The functionality
is provided by the framework.
As for the second statement, regarding operator overloading, .NET
doesn't support it outright. The language picks it up through specially
named static method signatures. VB now honors this convention as well, but
the framework doesn't enforce it.
I do think that the author could have phrased the second part a little
better.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
> I'm reading Professional C# (Wrox) and stumbled across:
>
[quoted text clipped - 7 lines]
>
> / Fister
Fred Mellender - 31 May 2007 23:15 GMT
They might be referring to features built into the CLR, and not exposed by
the C# language, but which might be used/exposed in some other .NET
language.
I'm not expert enough to give an example, but it *might* be that the CLR has
direct support for pointers and associated logic in order to implement C++,
but such features are not used/exposed/"supported" by C#.
> I'm reading Professional C# (Wrox) and stumbled across:
>
[quoted text clipped - 7 lines]
>
> / Fister
Marc Gravell - 31 May 2007 23:49 GMT
> features built into the CLR, and not exposed by
> the C# language
That would be the other way around to the OP;
the classic example of CLR and not C# woud be
return-value overloading, which almost no
language supports, but which is legal CLR.
Marc
Jon Skeet [C# MVP] - 31 May 2007 23:56 GMT
> They might be referring to features built into the CLR, and not exposed by
> the C# language, but which might be used/exposed in some other .NET
[quoted text clipped - 3 lines]
> direct support for pointers and associated logic in order to implement C++,
> but such features are not used/exposed/"supported" by C#.
Another example is covariance and contravariance in generics - the CLR
has support for this (for interfaces) but C# doesn't expose it.
For more on this topic, see
http://blogs.msdn.com/rmbyers/archive/2005/02/16/375079.aspx

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too