> Example: msdn says explicitly that enumerable/enumerators are exposed
> via foreach. It says so a thousand times everywhere. Ok.
[quoted text clipped - 4 lines]
> Convert.ConvertTo(xxx) though I suspect it does. But then maybe it
> doesn't and there are subtle differences.
No, it doesn't.
> Question: Is there a place in msdn which I am missing that documents
> every .net feature that in some form or other is expressed via a
> specific C# construct, keyword, etc.
Well, the C# language specification is the best place to go for that.
Download it from http://msdn2.microsoft.com/en-us/vcsharp/aa336809.aspx
However, off the top of my head:
foreach statement - IEnumerable/IEnumerable<T>/IDisposable
using statement - IDisposable
lambda expressions - Expression tree types
iterator blocks - IEnumerable/IEnumerable<T>/IDisposable
Query expressions use Enumerable/Queryable etc - but the compiler
itself doesn't know about them.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
For all of this, the language spec mainly (ECMA 334 for C# 2; I don't
know the number for C# 3 [is there one yet?]). Unfortunately it is
rather dry reading. I could start listing, but I'd surely miss a good
pile of them...
> says explicitly that enumerable/enumerators are exposed via foreach
While it is true that enumerable/enumerables are usable via foreach,
*strictly* speaking you need neither IEnumerable[<T>] nor
IEnumerator[<T>] (15.8.4 of ECMA 334)
> Nowhere could I find
> that the compiler translates language constructs into calls to
> Convert.ConvertTo(xxx) though I suspect it does.
I suspect that it uses the implicit/explicit conversion operators
defined for the types in question; see 8.2.2 of ECMA 334
Marc
igivanovg@gmail.com - 25 Feb 2008 21:04 GMT
> For all of this, the language spec mainly (ECMA 334 for C# 2; I don't
> know the number for C# 3 [is there one yet?]). Unfortunately it is
> rather dry reading. I could start listing, but I'd surely miss a good
> pile of them...
Thanks.
> > Nowhere could I find
> > that the compiler translates language constructs into calls to
> > Convert.ConvertTo(xxx) though I suspect it does.
>
> I suspect that it uses the implicit/explicit conversion operators
> defined for the types in question; see 8.2.2 of ECMA 334
Well, I searched the Standard, there is not a single mention of the
System.Convert class, which puzzles me. If Convert is not used
implicitly by the language, then its relation to C# conversions is
unclear and it's unclear what one should use Convert for, at least in
C#. If it is implicitly used, then I guess we have a documentation bug
in the Standard or in the MS implementation of C#.
(While I am interested in the Convert case, I mentioned is just as an
example)
------------
Igor
Jon Skeet [C# MVP] - 25 Feb 2008 22:07 GMT
> > I suspect that it uses the implicit/explicit conversion operators
> > defined for the types in question; see 8.2.2 of ECMA 334
[quoted text clipped - 8 lines]
> (While I am interested in the Convert case, I mentioned is just as an
> example)
No, it's not used by the C# compiler. There are various cases where
Convert does things which "pure C#" can't do - converting strings into
integers, for example. Those are the primary uses of Convert in my
experience.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk