Escolar Documentos
Profissional Documentos
Cultura Documentos
LINGUAGEM C#
NAMESPACES
• Classes
• Interfaces
• Estruturas
• Delegates
32
CAPÍTULO 2 - CONCEITOS BÁSICOS DA LINGUAGEM C#
33
C# PARA INICIANTES
NomeDaEmpresa.NomeDoProjeto.CamadaDoProjeto.Funcionalida-
de
Exemplo:
34
CAPÍTULO 2 - CONCEITOS BÁSICOS DA LINGUAGEM C#
Microsoft.LivroCSharp.CamadaDeDados.ConectorSqlServer
CLASSES
35
C# PARA INICIANTES
namespace SistemaBancario {
public class Gerente {
public string Nome { get; set; }
public int Idade { get; set; }
public int Cpf { get; set; }
}
}
36
CAPÍTULO 2 - CONCEITOS BÁSICOS DA LINGUAGEM C#
namespace SistemaBancario{
public class Gerente {
public string Nome { get; set; }
public int Idade { get; set; }
public int Cpf { get; set; }
public void AprovarHorasDeFuncionarios(int cpf){
//lógica para aprovar horas
}
}
}
37
C# PARA INICIANTES
OBJETOS
38
CAPÍTULO 2 - CONCEITOS BÁSICOS DA LINGUAGEM C#
namespace SistemaBancario{
public class InstanciaObjeto
{
public static void Main()
{
var objetoGerente = new Gerente();
}
}
}
39
C# PARA INICIANTES
VARIÁVEIS
namespace SistemaBancario{
public class InstanciaObjeto
{
public static void Main()
{
var objetoGerente = new Gerente();
}
}
}
40
CAPÍTULO 2 - CONCEITOS BÁSICOS DA LINGUAGEM C#
Tipo Exemplo
Tipos integrais sbyte, byte, short, ushort, int, uint, long, ulong, and char
Por exemplo:
namespace SistemaBancario{
public class Variaveis
{
public static void Main()
{
int cpf = 123456789;
string nome = “Ray Carneiro”;
decimal salario = 1000;
bool funcionarioAtivo = true;
}
}
}
42