Why do we use _ in variable names?

It doesn’t mean anything. It is rather a common naming convention for private member variables to keep them separated from methods and public properties. For example:

class Foo
{
   private int _counter;

   public int GetCounter()
   {
      return _counter;
   }

   public int SetCounter(int counter)
   {
      _counter = counter;
   }
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)