views:

358

answers:

4

Possible Duplicates:
Is there a site that emails out daily C# tips and tricks?
What are your C# Commandments?

A little background: I have skimmed through Effective C# by Bill Wagner. I know that my opinion on a book like that is too insignificant. But, still just for record I plan to read and re-read the books for years to come. It is just too good.

Now the question: Can SO C# gurus tell me their favorite C# tip(s) to make their code effective.

EDIT: I looking for something that C# gurus use in their day-to-day coding to make it effective. I am not looking for hidden features of C#. If this has already been answered let me know. Thanks.

A: 

Measure, optimize and measure to make sure you did optimize it.

Also, the compiler and garbage collector usually are smarter than you are. Let them do their jobs.

pb
+2  A: 

We have a simialr questions :

Hidden Features of C#

Is there a site that emails out daily C# tips and tricks?

Shoban
+1 Thanks for letting me know. But I looking for something that C# gurus use in their day-to-day coding to make it effective.
P.K
Most hidden features should be used daily.
zeroDivisible
A: 

Without question, LINQ is one of the most powerful tools available, and the C# integration is superb. It changes how you think about shaping and processing data in a strongly-typed language. I highly recommend becoming proficient in this area.

There are also many cases where the compiler supports syntactic sugar for common patterns, such as automatic properties, the using, foreach, and yield return statements, type inference, lambda expressions, extension methods, object and collection initializers, etc. The list goes on and on. Learning these features and the patterns behind them can drastically reduce the amount of code needed to express particular concepts.

Bryan Watts
A: 

No fancy tricks, just clear well documented code, because in the end you will have to come back to it at 3am in the morning and curse the bug that your cleverness created.

Andrew Cox