As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . Locked. This question and its answers are . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.

This came to my mind after I learned the following from this question:

where T : struct

We, C# developers, all know the basics of C#. I mean declarations, conditionals, loops, operators, etc.

Some of us even mastered the stuff like Generics, anonymous types, lambdas, LINQ, ...

But what are the most hidden features or tricks of C# that even C# fans, addicts, experts barely know?

Here are the revealed features so far:





Keywords

Attributes

Syntax

?? (coalesce nulls) operator by kokos

(coalesce nulls) operator by kokos Number flaggings by Nick Berardi

where T:new by Lars Mæhlum

by Lars Mæhlum Implicit generics by Keith

One-parameter lambdas by Keith

Auto properties by Keith

Namespace aliases by Keith

Verbatim string literals with @ by Patrick

enum values by lfoust

values by lfoust @variablenames by marxidad

event operators by marxidad

operators by marxidad Format string brackets by Portman

Property accessor accessibility modifiers by xanadont

Conditional (ternary) operator ( ?: ) by JasonS

) by JasonS checked and unchecked operators by Binoj Antony

and operators by Binoj Antony implicit and explicit operators by Flory

Language Features

Visual Studio Features

Select block of text in editor by Himadri

Snippets by DannySmurf

Framework

TransactionScope by KiwiBastard

by KiwiBastard DependantTransaction by KiwiBastard

by KiwiBastard Nullable<T> by IainMH

by IainMH Mutex by Diago

by Diago System.IO.Path by ageektrapped

by ageektrapped WeakReference by Juan Manuel

Methods and Properties

String.IsNullOrEmpty() method by KiwiBastard

method by KiwiBastard List.ForEach() method by KiwiBastard

method by KiwiBastard BeginInvoke() , EndInvoke() methods by Will Dean

, methods by Will Dean Nullable<T>.HasValue and Nullable<T>.Value properties by Rismo

and properties by Rismo GetValueOrDefault method by John Sheehan

Tips & Tricks

Nice method for event handlers by Andreas H.R. Nilsson

Uppercase comparisons by John

Access anonymous types without reflection by dp

A quick way to lazily instantiate collection properties by Will

JavaScript-like anonymous inline-functions by roosteronacid

Other