473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

new features in c# 3

Hi,

I just read some blogs which listed new features of c# 3.0. They
listed things like Automatic Properties,Object Initializers etc.

But frankly I do not see big changes from c# 2. It is not like in c#
2, they finally give us generics. Compare c# 2 to c# 1.1, generics is
something huge.
But I read part of c# 3 specifications, I don't have this feeling yet.

Maybe I missed something? Whould some one point it out for me?

Many Thanks

Jerry
Dec 7 '07 #1
5 1287
And you'd be right... to a point ;-p

The C# 3 changes are largely (on the surface) some minor compiler
conveniences - but good conveniences. Extension methods, for instance,
I've already used in a number of scenarios completely unrelated to
LINQ. Many of the features tie tightly to eachother - for instance,
anonymous types demand the "var" type inference. Lambdas (as
delegated) feel cleaner than the older syntax, but yes: *by itself* it
isn't a killer feature (although the facility to compiler to an
Expression rather than a delegate is /extremely/ powerful - but
obviously demands .NET 3.5 [which C# 3 itself doesn't]).

However, the features really come into their own when considered with
their relationship with LINQ (.NET 3.5). Almost everything in C# 3
relates to LINQ in some way, so it is hard to evaluate their use
without some mention of LINQ. I started typing an "in particular", but
to be honest so much of the changes tie to LINQ that it became
unnecessary. Maybe auto-properties don't tie to LINQ... but that's
about it...

Regardless of your thoughts of LINQ-to-SQL etc, LINQ surely represents
an extremely powerful and expressive step forward, which hopefully
will make it easier for code to indicate what it is trying to achieve,
rather than masses of step-by-step how to do it.

This again important if you want to use things like PFX (or Parallel
Extensions, whatever they are calling it now), which is important
given the migration towards multi-core computing - the compiler can't
do anything with overly-specific code, but if you express your intent
and let the framework worry about implementation (rather than having
to continually write lots of parallel plumbing, and making lots of
mistakes in the bargain) you are onto a winner.

If you are interested in more information about the C# 3 particulars
and their advantages [or just more info], rather than focusing on
the .NET 3.5 details [which are of course mentioned, but only to
explain the "what?" and "why?"], then I can recommend Jon Skeet's
forthcoming book - it is /heavily/ geared toward the language rather
than the framework.

http://www.manning.com/skeet/

Marc
Dec 7 '07 #2
One other comment; remember that there is no CLI/CLR update for C# 3,
so there aren't any huge new concepts like generics; everything fits
mainly as compiler tricks within the existing frameworks (CLR 2.0),
with some optional features (Expression compilation) drawing from
framework updates (.NET 3.5). But no IL changes.

The default LINQ providers obviously draw from .NET 3.5, but this is
not tied directly to the compiler; the extension methods etc just
happen to pick them up according to the langauge spec. You can write a
LINQ-to-objects implementation in .NET 2.0, for example.

Marc
Dec 7 '07 #3
On Dec 7, 11:20 am, D...@hotmail.com wrote:
I just read some blogs which listed new features of c# 3.0. They
listed things like Automatic Properties,Object Initializers etc.

But frankly I do not see big changes from c# 2. It is not like in c#
2, they finally give us generics. Compare c# 2 to c# 1.1, generics is
something huge.
But I read part of c# 3 specifications, I don't have this feeling yet.

Maybe I missed something? Whould some one point it out for me?
As Marc pointed out, there are no CLR changes like generics and
nullable types in 2.0. However, I think that LINQ (and indeed lambda
expressions in general) will actually make *more* of a change to how
we code. Rather than being a refinement of existing style, C# 3
encourages you to think more functionally/declaratively.

It's up to you, of course - you can choose to use C# 3 as if nothing
had changed, but you'll be missing out :)

Of course, I second Marc's recommendation of my book, by the way ;)

Jon
Dec 7 '07 #4
DA**@hotmail.com wrote:
Hi,

I just read some blogs which listed new features of c# 3.0. They
listed things like Automatic Properties,Object Initializers etc.

But frankly I do not see big changes from c# 2. It is not like in c#
2, they finally give us generics. Compare c# 2 to c# 1.1, generics is
something huge.
But I read part of c# 3 specifications, I don't have this feeling yet.

Maybe I missed something? Whould some one point it out for me?
I think the change is huge - particularly lambda expressions.

If I'm writing C# 2 code for other developers to use, I'm not likely to
expose a method that takes a delegate to control some aspect of that
method (I'd do that internally, but methods I expose to other developers
would take an object implementing an interface which basically wraps the
delegate in a method).

In C# 3, I'd be quite happy to expose a method taking a Func because
people know to supply a lambda (and they don't need to know the details
about how it works).

That's a pretty big change - at least as much as generics.

Alun Harford
Dec 8 '07 #5
Alun Harford <de*****@alunharford.co.ukwrote:

<snip>
In C# 3, I'd be quite happy to expose a method taking a Func because
people know to supply a lambda (and they don't need to know the details
about how it works).
I think there are some details they don't need to know about, and some
they do. The exact procedure of type inference is really complicated
now, for instance - and most of the time you really don't need to know
what the compiler's doing. Captured variables, on the other hand, can
radically affect how your program behaves, and if you start using them
without being aware of them you could have a real problem on your
hands.

--
Jon Skeet - <sk***@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
Dec 8 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kl | last post by:
Hi, python is really easy to learn in my opinion. There are loads of tutorials/books on the web talking about the most common python features. The problem comes when they add something new to the...
18
by: 5460lqh | last post by:
who can tell me which two features in the C++ language are most usefule, and which two features that you think are the most over-rated or the most misused and why you think so? Thanks very much!
2
by: zhaoyandong | last post by:
One of my interviewers ask me "Two favorite features of C++, and over-rated, and misued features" Could anybody give me some advice on this? Thanks
18
by: Michael B Allen | last post by:
Is it considered a bad idea to use a C99 only feature? It has been almost 6 years right? Specifically I'm interested in variadic macros. All of my code is C89 (or less) except for my debugging...
8
by: Servé Lau | last post by:
I've read the new features that are coming to the next VC and they all sound fine. But I was missing new standard C++ features, will the features like export still not be implemented? What...
6
by: aron t | last post by:
Hi, I am good php programmer and want to learn asp.net. Can someone tell me what are the best and the worst features of ASP.NET? thanks
0
by: Shawn Cutter | last post by:
I am beginning work on a somewhat complex project and I need to decide what route to take before beginning the project. The main issue with this project is that it needs to be modular and support...
148
by: BillJosephson | last post by:
Want to do OOP. Does c++ have all the abilities of java, or is it some subset? Thanks...
7
by: Fister | last post by:
I'm reading Professional C# (Wrox) and stumbled across: "Some features are supported by.NET but not by C#, and you might be surprised to learn that some features of the C# language are not...
5
by: bearophileHUGS | last post by:
I often use Python to write small programs, in the range of 50-500 lines of code. For example to process some bioinformatics data, perform some data munging, to apply a randomized optimization...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.