I was able to complete the Lambda expressions section in the LINQ Tutorial.
Last week I felt a bit tired and I got half of this week off. And as typical tech geek I used some of the time to play with VS Orcas March CTP and to grow LINQ Tutorial a bit.
It is nice to get some days off :)
I've just published the update of LINQ tutorial I started in Bulgarian. I cover two new features in C# - Auto-implement properties (I bloged about this too) and Extension methods.
I hope bulgarian readers will find them interesitng.
While I dug into Orcas March CTP Documentation I found another new C# feature (at least for me). It is called Partial Method Definitions and allows you to separate method definition and method implementation in partial classes.
//Definition
partial void partial void onNameChanged();
//Implementation
partial void onNameChanged()
{
//method body
}
As I have C++ background this sounds familiar to me and reminded me times when I had to declare methods in .h (header) files and put implementation in .c/.cpp files.
To be honest I am not able to find the advantages of this new feature but I suppose there will be more blog post soon that will discuss this.
As I emphasize above you can separate method definition from implementation only in partial classes. There are number of restrictions stated in Orcas documentation:
-
Partial method declarations must begin with the contextual keyword partial and the method must return void.
-
Partial methods can have ref but not out parameters.
-
Partial methods are implicitly private, and therefore they cannot be virtual.
-
Partial methods cannot be extern, because the presence of the body determines whether they are defining or implementing.
-
Partial methods can have static and unsafe modifiers.
-
Partial methods can be generic. Constraints are placed on the defining partial method declaration, and may optionally be repeated on the implementing one. Parameter and type parameter names do not have to be the same in the implementing declaration as in the defining one.
-
You can not make a delegate to a partial method.
I have downloaded VS Orcas March CTP and I am playing with its features now.
I found one very cool feature called Auto-Implemented Properties. This will allow you to create private field and public property accessor with single C# 3.0 line like this:
public string FullName { get; set; }
instead like in c# 2.0:
private string fullName;
public string FullName
{
get { return fullName; }
set { fullName = value; }
}
And as with the others cool language sugars the compiler will do the rest :). Actually it doesn't look that good but still it works. For the single line property above I got the following code in Reflector:
public string FullName
{
[CompilerGenerated]
get
{
return this.<>k__AutomaticallyGeneratedPropertyField0;
}
[CompilerGenerated]
set
{
this.<>k__AutomaticallyGeneratedPropertyField0 = value;
}
}
Nice huh?
Of course this won't work if you have complex getters and setters but still will speed up code writing and leave more time for thinking :)
Most of have seen such images and probably tools to create ascii pictures

There is good explanation on how to convert image to ascii on Wes Dyer's blog. And even cooler - this is done with new c# 3.0 language features.
Go and read yet another image2acsii converter from Yet Another Language Geek's blog :)
download the virtual PC images from:
or download the installer:
(guess why my bandwidth is filled :) )
Next part of C# 3.0 and LINQ Tutorial is alive.
In it I cover anonymously-typed variables and Anonymous types.
Again it is in Bulgarian. I hope bulgarian readers will like it.
I as posted before I started tutorial about C# 3.0 and LINQ.
I as able to write the next part - Object and Collection Initialization Expressions in C# 3.0.
This one probably will be extended so stay tuned!
After speaking with my friend Marto I decided to write a tutorial about forthcoming features in new version of the very popular language C#.
As always there is a lack of development materials in Bulgarian so it is written in Bulgarian and there is no language barieer for bulgarian developers who wants to take a look behind the corner to new version of our favorite C#.
There is posibility to translate the whole tutorial in English (when it si finished) so this could be good starting point for all English speaking devs but this depends on the interest (and my availability).
I have posted first two parts (of total 13 so far): Introduction and Acknowledgment with LINQ and basic capabilities.
I hope I will be able to post next part very soon (projected within next two weeks) and I will announce it here.
In the meantime I will be very grateful for your feedback. Any comments, reccomendations and request for more detailed reviews are welcome. You can post them as comments on the blog or to my emails stated on here.
Thank you
Yesterday I installed VS "Orcas" January CTP on my machine in order to take deeper look at things that are comming.
I was a bit surprised I could not find VS LINQ project templates and compiler throws compile error on correct linq statement.
This was kind of strange - The VS version that introduces LINQ return compile error on correct LINQ statement ???!?!?!?
The problem was only in referenced assemblies as this post says.
So to have LINQ syntax in your VS "Orcas" you have to:
- Add reference to LINQ assemblies located in C:\WINDOWS\Microsoft.NET\Framework\v3.5.*. You can reference them all or only those you need (The important ones are System.Core.dll, System.Data.Entity.dll, System.Data.Linq.dll and System.Xml.Linq.dll
The core is for the standard linq queries, where Data.Linq and Xml.Linq are what the old DLinq and XLinq were. )
- Add using clauses at the top of source files.
using System.Linq;
using System.Data.DLinq;
using System.Xml.Linq