I went to a VS User Group meeting last night and there was short presentation on C# 3.0. Here is what I have learned so far:
1. Object is first class and you won't see much ADO.NET in code. This concept is not new because there are already many ORM out there like LLBGen, NHibernate and many more. The difference is that it kind of mixing the familiar SQL syntax right into the language which is not favorable to some people, but praise by many. Overall, it's not bad in my opinion.
2. The good thing I like about it is you can catch errors at compile time that I think is very cool. Current SQL statement can throw a nasty run-time exception which is not cool at all
3. I didn't ask the question regarding to the famous error "Type impedance mismatch" I have heard that this would solve this annoying problem.
4. You can extend it like the way you extend your classes.
This C# 3.0 sounds very exciting. The question is whether we have enough times to learn what's coming in VS 2005 before this thing pops up in our face again.
codewhiz wrote:A bit too early but this is an excellent introduction to what is coming http://blogs.tedneward.com/2005/09/22/Language+Innovation+C+30+Explained.aspx Frankly, I have zero experience with such features and I am not even sure if there are any languages with such features. Personally, I do not care what code is their in IL ( OK, for performance reason that matters.), I mostly write the code to be readable, and for maintainance. -cw
Cyrus Crypt wrote: Agree with you here. I saw the part on "Implicitly typed variables", and it seems like we are falling back to VB6.0 and ASP days. Although there is no performance penalty here, as the IL is the same; what about code readibiliy and maintenance? Is taking type instantisation decision away from developer a good thing? I remember my first project that I took over. I couldn't understand much of the previous developer's design intention, as there was no data type. Debugging was hell.
codewhiz wrote:I think we all here understand the automagic happening here. You will get compile time errors. But what about understanding the code?Most of the time you will be using that feature not to instantiate variable like var i =0; but while return values from other functions and this feature might tend to be used in more laziness than rather good design-wise or productivity.
I agree with feelite here. var i = whatever type you assign on the right side. It can be an object, data from database, or simply a string. It's dynamic in the coding content and strong type in the compiling content. The beauty is that after the assignment, you can't simply reassign it with a different type. The compiler will enforce the strict rule. Generic behaves in a similar fashion. Please correct my statement if anyone find that it behaves differently because I'm learning it too.
I especially like the lambda expressions. Imagine this:
//returning even numbers
List<int> arrInt=new List<int>{1,2,3,4,5,6,7,8,9,10};//new functionality in .NET 3.5
in .NET 2.0
List<int> evenInt=arrInt.FindAll(delegate(int i) { return i%2==0;});
in .NET 3.5
List<int> evenInt=arrInt.FindAll(x=>x%2==0);
http://devpinoy.org/blogs/cruizer