Thursday, June 07, 2007

Tech Ed Day 4 - More on C# 3.0

Sessions today started at 8am, but I mistakenly turned up at 8:30 as that's when previous day's session have started. So I unfortunately missed the first half of Microsoft Visual C# Under the Covers: An In Depth Look at C# 3.0.

I've already written about some of the new features that were covered in the LINQ session from Tuesday, but I was hoping to find out more today. Judging by the summary given at the end though I don't think I missed anything that wasn't at least introduced in the LINQ session.

The thing that I walked in on though was usage of the "yield" keyword. This isn't a C# 3.0 keyword though, it's in 2.0 already, but I didn't know about it. I found this article on what it is, and it's pretty useful if you are providing your own implementation of GetEnumerator.

Another thing mentioned was Extension Methods. The idea of these is that you can increase the number of methods on an existing type to include the operations that you need. This article goes into some depth on it.

Then the final thing that I heard about was Partial Methods. These are similar to the partial classes that we have in C# 2.0 but obviously apply to methods. They seem to be hooks in the code for allowing other classes to provide implementations for. I found an article that explains it somewhat, and explains where they could be used.

Another interesting point though, was that the C# 3.0 compiler is backwards compatible with C# 2.0 code, so the new compiler can be used straight away. I'm not sure where to get it from to try it out though, or whether it's stable enough for production code yet.

If anyone does know, leave a comment.

1 comment:

Paul Hallam said...

Hi Ian

Glad to see you are enjoying yourself in Orlando.

Product info regarding V3.0 Framework etc at

VS 2005 extensions for .Net 3.0 here :

And VS2008 Beta 1 [formerly Orcas) with everything for .Net 3.x is available for download at