Naming Conventions for declaring variables



We should follow some conventions for naming a variable which as given below

We should always use the camel case while declaring variables.

var studentList = new List<T>();

Declaration of variable which returns a single object

var student = new Student();

Declaration of variable which returns multiple objects

//add "s" or "List" suffix:
var students = new List<Item>();
//or
var studentList = new List<Item>();

Declaration of a private variable

//use "_":
private int _num = 10;

0 Comment's

Comment Form

Submit Comment