I'm trying to learn C # language. In this case I'm trying to make the Console show the value of the balance, taking this value from a different class in the same file (already tried with multi-files and still does not work, the compiler does not see the variable). >
using System;
using namespaceb;
namespace namespaceb
{
public class saldo
{
public int numero = 100;
}
}
namespace namespacea
{
class Program
{
static void Main(string[] args)
{
saldo teste = new saldo();
Console.WriteLine(numero); //dá erro "O nome Numero não existe no contexto atual"
Console.WriteLine(teste); // mostra uma linha "namespaceb.saldo"
Console.ReadKey();
}
}
}