C sharp code cleanup : resharper

Posted by Ankit Rathod on Stack Overflow See other posts from Stack Overflow or by Ankit Rathod
Published on 2010-12-30T16:45:48Z Indexed on 2010/12/30 16:54 UTC
Read the original article Hit count: 334

Filed under:

Hello,

I just used Resharper in one application and it made me feel as if i don't know how to code at all in C# :(. On every line it gave me it's suggestions :-

Few of Resharper's favorite suggestions are :-

1) SomObject o = new SomeObject();

Resharper will convert to :

var o = new SomeObject()

2) this.Loaded += new RoutedEventHandler(MainPage_Loaded);

to

this.Loaded += MainPage_Loaded;

3) convert my variables and putting _ in front of all instance variables.

4) Removing class parent's name. I tested this on Silverlight.

public partial class MainPage : UserControl

to

public partial class MainPage

EDIT :-

5) replace instance variable

 this.variable = somevalue

to

 variable = somevalue

Are all of these really necessary? Is it really going to affect the efficiency of my program? I mean what good is it going to do by replacing my class names with var keyword. After all var is also replaced with class name at compile time. Is it doing because it has been programmed to do or do these things really affect in some or another way?

Thanks in advance :)

© Stack Overflow or respective owner

Related posts about c#