FANDOM


CSharp
 

Hello people!

Variables are parts of program that keep some value in memory.


Variables are in C# declared like this:

[data type] [name];

Example:

int number;

Its very important to assign value to variable when you delcare it.

[data type] [name] = [value];

Example:

int number = 0;

Its good idea to give variable visibility level:

Example:

public int number = 0;

More about visibility levels you can find here:

Tutorial:Visibility

Value Types:Edit

  • bool
  • byte
  • char
  • decimal
  • double
  • enum
  • float
  • int
  • long
  • sbyte
  • short
  • struct
  • uint
  • ulong
  • ushort

Reference Types:Edit

  • class
  • interface
  • delegate
  • object
  • string