VS Tricks01

  1. Line numbers aren’t displayed by default in VS. To enable it go to Tools > Options > Text Editor > C# > General. There check the option ‘Line Numbers’
  2. C# is Block-Structured language, meaning all statements are part of a ‘block of code’. The blocks of code represented by curley brakcet {} can contain any number of statements.
  3. Go to Tools > Options > Text Editors > C# > Formatting to tweak the settings to atch your personal work style.
  4. Comments: Use /* and */ to comment block of code. Use // in the begining of the line to comment everyting on the line after //.
  5. Commenting using /// is used to tell C# to extract the text after these comments and create a specially formatted text file, when a project is compiled, which can be used to create documentation.
  6. C# is case-sensitive, meaning you need to enter code in right case.
  7. Code Outlining can be achieved by using #region #endregion keywords. This allows you to collapse these lines of code into a single line. # is actually a preprocesor directive and not C# keyword and have specialized uses. Case Outlineing example:

#region Using directives

using system;

using system.text;

#endregion

Leave a Reply

Enter the CAPTCHA * Time limit is exhausted. Please reload CAPTCHA.