What is Variables in C#

Now we are going to learn about the variables and how many kind of the variables are there in C#.
  • 1606

Introduction

A variables in a programming language can be compare to a store room, and is essential for the programmer. Variables represent storage locations and every variable stores same type of the variable. It is sure C-sharp compiler know that variables can stored in there appropriate location because of C-sharp is a type-safe language. But some cases values of the variables can change there by the assignment and ++,- - operators.

C# have seven type of variables.

  • Static variables.
  • Instance variables.
  • Array elements.
  • Value Parameters.
  • Reference Parameters.
  • Out put parameters.
  • Local Parameters.

Example
class Program
    {
    public
 static int x;
     int y;
       void
 f(int[] v,int a, ref int b, out int c
    {
          int i=1;
             c=a+b++;
    }
    }
Here x is a Static variable, and Y is an Instance Variable,V[0] is an array, a is value parameter, b is ref parameter, I is local parameter is output parameter.
 

© 2013 dotNetheaven. All rights reserved.