• Welcome to the arena
C Sharp/Variables

From Marvin's Arena

Jump to: navigation, search

A Variable is a place to store data. In C# you define variables with a type and a name. The name of the variable should be meaningful.

Type MyVar;

The standard Types are defined in the .NET Framework.

int sum;

Assignment

Values can be assigned during the declaration or within the same scope (Global, Class, Method).

int sum = 42;
//is equal to
int sum;
sum = 42;