tags:

views:

498

answers:

23

What's the feature you love the most in C#?

Does it come from the new .NET 3.5 or is it just from the original C#?

It can be as simple as the recommendation for camelCase and PascalCase, or as advanced as anonymous methods. What makes you like the C# language?

+2  A: 

One thing I really like is it can be used in a lot of ways. I can write windows forms applications, WPF applications, console apps, web apps, XNA apps, etc.

Totty
+10  A: 

The way it all hangs together. If you look at all the changes in C# 3 (with the possible exception of how extension methods are discovered) it still stays true to the original roots, while giving massive amounts of functionality.

Also the way query expressions are compiled as a sort of "pre-main-compilation step" (which means their impact is pretty much solely within a single section of the spec) is really, really neat.

Basically C# has been thought through extremely carefully, and it shows.

Jon Skeet
You make a good point, It does just hang together well.
tdyen
+3  A: 

LINQ. LINQ to XML, LINQ to SQL, and LINQ to Objects all provide immense value.

I was initially skeptical of the LINQ to SQL functionality, but even that ended up pretty well. I tend to use LINQPad in place of SQL Management Studio. LINQ to XML also trivializes one of the most common tasks in enterprise application development.

Gabriel Isenberg
+3  A: 

Irritating C# diehards by pronouncing it "see pound." So many more puns become available...

heh heh heh... still cracks me up...

Adam Davis
... or 'see hash' ...
ConcernedOfTunbridgeWells
or 'see octothorpe"
Kevin
Might as well fill in the last one: "see number sign"
Adam Davis
I prefer D flat =)
Eyvind
+7  A: 

It's simplicity for one, it's a powerful language yet so simple, I like the fact that they are putting functional language aspects into also, I don't know how far C# will go but I believe it's going to be one of the languages used religiously like C++ is used today.

  1. Simplicity
  2. Functional properties
  3. Power and extent of the .NET library at it's disposal
  4. Beautiful elegant Syntax
  5. Easy to teach, easy to learn, easy to enjoy.
Rayne
+6  A: 

Generics. (I know they're not unique to C# but coming from Delphi, Generics are awesome).

Ray
+13  A: 

The framework. As good of a language as C# is, it is really propelled forward by the supporting libraries.

vfilby
This is really true of any language. The language itself can generally be described in a few pages of text, but it's the libraries that make it or break it in the market. C# started off with a good framework, and built itself on that.
Adam Davis
I agree. PHP is a fine language. I only wish it had a as good of an API as .Net
Kibbee
+3  A: 

Delegates!

FlySwat
+2  A: 

Reflection and metadata.

Nick
These are not really C# features, so much as features of the .NET framework.
Jason Bunting
+6  A: 

I like very much the new C# 3.0 features, like the automatic properties and the object initializers, much less typing!

public class Person 
{    
   public string FirstName  { get; set; }
   public string LastName  { get; set; }
} 

Person p = new Person()
{
    FirstName = "John",
    LastName = "Smith",
};

I also love Lambda Expressions:

(y,z) => return y * z;

CMS
Anything that takes away the last lazy excuse for public fields is a definite plus ;-p
Marc Gravell
I am sure you know you don't need the return keyword for that lambda. In fact, that won't even compile. Func<int,int,int> func = (y,z)=>{return y*z;}; will compile, as will Func<int,int,int> func =(y,z)=>y*z;
Jason Jackson
+2  A: 

I liked C# ever since the first time I started intensively working with it (that would be version 1.1) because:

  • it was pure OO language;
  • pretty nice syntax

But I started loving it only when I learned how to use yield statement and create anonymous methods (C# 2.0). I started truly adoring it when I wrote my first extension methods and classes that didn't require me to define to private fields and totally repetitive getters/setters (as CMS has illustrated above).

Now I see C# as a big brother to Ruby, a language I love for its simplicity and expressive power.

.NET Framework Class Library is certainly good, but it doesn't affect my love for C# as a language much.

Damir Zekić
+2  A: 

developers, developers, developers, developers!

Oh, and properties. They're kinda cool, too.

Otm Shank
+1  A: 

I like the # part :)

Kon
+2  A: 

Nice familiar syntax, but with the convenience and power of the .NET framework behind it. Oh, curly brace, how do I love thee, let me count the ways.... :)

Adam Neal
+2  A: 

The syntax. Its similarity to Java and other C-style languages makes it very easy to pick up, as nearly every programmer has been exposed to it at some point. Also, I have been continually amazed at how extensible it is -- they've added generics, functional programming, Linq and other syntactic suger without compromising the integrity of the original design.

The addition of similar features, particularly inline initialization, has felt very cumbersome in VB.Net, as was one of the reasons I switched.

Adam Lassek
A: 

System.Text.RegularExpressions

Josh Bush
Why was that downvoted? Regular Expressions can be very useful.
Aaron Smith
Somebody's not down with Regex? How about System.Data. Now there's a nice namespace.
Josh Bush
Not really a C#-specific feature though (note, the downvote wasn't from me). In fact, C# (the language) does *nothing* for regex.
Marc Gravell
+2  A: 

2 things, both compiler tricks:

  • iterator blocks - the compiler does such a good job of making this easy (remember the C# 1.2 way of writing an iterator? shudder...)
  • captured variables - in both anonymous methods and lambdas. Very elegant when you look at how it works under the bonnet.
Marc Gravell
+2  A: 

The extensions methods that come with Linq. They shorten my code quite a bit.

Aaron Smith
+4  A: 

I like it's C style syntax. This makes it much easier to glance at the code and understand it than more "wordy" languages like VB.

Chris Pietschmann
+5  A: 

Someone already said "the framework" but I would highlight two "sub frameworks" in particular: ADO.NET and ASP.NET. The difference in database and web programming before and after having those framework bits is like night and day. Rails has its merits along these lines, but between ASP.NET MVC, ADO.NET Entity Framework, and Linq, the clear advantage is with the .NET web framework.

Parvenu74
+2  A: 

I don't know why, but I like yield return

Varun Mahajan
+1  A: 

automatic properties, foreach loops, generics!

A: 

I love LINQ. I'm forgetting how to write SQL joins and I'm a happier person for it.

Echostorm