Re: Some notes on C# 3.0 (was RE: [DOTNET-CX] How to overload == for System.Double)

Alan Baljeu <[email protected]> Mon, 5 Feb 2007 09:25:34 -0500
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <098401c74931$804996c0$1dc80ac6@CTI>
> I guess it all depends on personal taste; for some
> individuals things like lock, using and foreach in C# 1.0
> could be seen as syntactical sugar for library functionality;
> in C# 2.0 the stuff around iterators is a far more complex
> piece of syntactical sugar that performs much more code
> generation than some might think (one keyword "yield" results
> in a massive amount of code generation); in C# 3.0 the
> expression tree stuff is on that same level while other
> features are much simpler substitution patterns with a
> few[C#]:few[MSIL] mapping scheme. You might argue that the
> way of thinking might be decisive to classify stuff in the
> syntactical sugar camp or not; whether you think
> implementation-driven (implicitly mapping on the runtime,
> MSIL, stack-based evaluation, processor instruction
> generating statement sequences, whatever is in a name) or
> results-driven (which LINQ syntax is clearly a good example of).

You mentioned a variety of things which seemed good and natural to C#, including all kinds
of sugar and extension methods.  I understand C# is happy with a variety of keywords which
introduce some new context for the code which follows.  I also understand that these are
usually shortcuts for something which could be written more verbosely.


So I can understand these new keywords, can you de-sugar for me the from, where and select
keywords below, and just use de-keyworded C# 3.0?

> IEnumerable<string> selectedWords =
>  from p in EinsteinQuote
>  where p.Equals("any") != true
>  select p;

Given that, I think I would understand more of what's going on.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com