1

I see lots of job ads for C#/.NET programmers, so I thought it could be a good idea to have had a look at it.

After looking at a few tutorials I found nothing really new to me. Just a language with a syntax somewhere between Java and C++ (arguably nicer than both though).

So, what features in particular should I look at? What are some special features? What's the reason that C#/.NET is so large? What are some killer features or perhaps some really evil language gotchas?

Links and code examples are very welcome.

I am using the Mono-implementation on Linux.

Hannes Ovrén
  • 18,969
  • 8
  • 64
  • 72

6 Answers6

8

The .Net Framework library is more important than the language.

Windows programmer
  • 7,583
  • 20
  • 22
  • It's the combination which is important. LINQ would be significantly less useful without extension methods, for example. – Jon Skeet Oct 06 '08 at 14:59
6

Compared with Java:

  • The "using" statement (try/finally is rarely explicit in C#) (C# 1)
  • Delegates as a first class concept (C# 1)
  • Properties and events as first class concepts (C# 1)
  • User-defined value types (C# 1)
  • Operator overloading (use with care!) (C# 1)
  • Iterator blocks (C# 2)
  • Generics without type erasure (C# 2)
  • Anonymous methods (C# 2)
  • Partial types (good for code generation) (C# 2)
  • Object and collection initializers (C# 3)
  • Lambda expressions (C# 3)
  • Extension methods (C# 3)
  • Expression trees (C# 3)
  • Query expressions (aka query comprehensions) (C# 3)
  • Anonymous types (mostly used in query expessions) (C# 3)

They're the things I miss from C# when I write in Java, anyway. (That's not an exhaustive list of differences, of course.) Which ones are most important to you is subjective, of course. From a simple "getting things done" point of view the using statement is probably the single biggest pragmatic gain, even though it only builds a try/finally block for you.

EDIT: For quick examples of the C# 2 and 3 features, you might want to look at my Bluffer's Guide to C# 2 and the equivalent for C# 3.

Jon Skeet
  • 1,261,211
  • 792
  • 8,724
  • 8,929
2

Killer feature: super fast Windows programming with Visual Studio.

supermedo
  • 562
  • 2
  • 4
  • 15
1

In C# 3.0 Linq (Language Integrated Query) is worth looking at.

Ash
  • 57,515
  • 31
  • 146
  • 168
1

Exception handling, garbage collection, reflection, a unified type system, machine architecture independence and performance are the main advantages the .NET CLR. The Base Class Libraries are quite comprehensive and comprehensible. Both C# and VB.NET are first class languages for building applications on this platform. Consider learning both.

Hafthor
  • 15,081
  • 9
  • 54
  • 62
0

You can find some of the not so obvious features here

Hidden Features of C#?

And yes, the framework is the largest selling point.

Community
  • 1
  • 1
Ed S.
  • 115,705
  • 20
  • 165
  • 244