Click here to Skip to main content
15,881,803 members
Articles / Programming Languages / C#
Alternative
Tip/Trick

Refactoring Tips - Tip 1

Rate me:
Please Sign up or sign in to vote.
4.56/5 (2 votes)
2 Mar 2010CPOL 6.5K   1
I actually prefer initialization over assignment, like this:private void Method(){ int Var2; int Var3; // some more statements int Var1(10);}In doing this you prevent later edits to again separate the declaration from the assignment by inserting code between them.
I actually prefer initialization over assignment, like this:

private void Method()
{
   int Var2;
   int Var3;
   // some more statements

   int Var1(10);
}

In doing this you prevent later edits to again separate the declaration from the assignment by inserting code between them.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Switzerland Switzerland
Graduated at TU Darmstadt in Math & CS, with a heavy focus on CAD/CAM

Programming and designing applications in C++ in the areas AI, real-time programming, client-server applications and CAD/CAM since 1985.

Personal interests: AI, computer graphics, games, reading

Comments and Discussions

 
GeneralMy vote of 1 Pin
Yoldas Askan15-Sep-14 7:02
Yoldas Askan15-Sep-14 7:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.