I'm learning C # to migrate a system in VBA to C #. I'm really enjoying the .Net language.
How do I declare a variable of integer type?
I'm learning C # to migrate a system in VBA to C #. I'm really enjoying the .Net language.
How do I declare a variable of integer type?
Just declare the type before its name:
int x; //declarando sem inicializar. Será inicializado implicitamente com 0
var y = 1; //usando inferência de tipo. Só funciona em variáveis locais
int z = 2; //definição (declaração+atribuição) explícita
The so-called built-in types of the language can be seen in this table . Contrary to what many think C # do not have so-called "primitive" types. These listings are those that language provides some extra facility for their use and recognition.