Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

#Para o vscode
.vscode

# User-specific files
*.suo
*.user
Expand Down
27 changes: 0 additions & 27 deletions 01-EstruturaDoPrograma/.vscode/launch.json

This file was deleted.

42 changes: 0 additions & 42 deletions 01-EstruturaDoPrograma/.vscode/tasks.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
27 changes: 0 additions & 27 deletions 02-Instrucoes/.vscode/launch.json

This file was deleted.

42 changes: 0 additions & 42 deletions 02-Instrucoes/.vscode/tasks.json

This file was deleted.

9 changes: 9 additions & 0 deletions 02-Instrucoes/02-Instrucoes1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>_02_Instrucoes1</RootNamespace>
</PropertyGroup>

</Project>
22 changes: 19 additions & 3 deletions 02-Instrucoes/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ namespace Instrucoes
{
class Program
{

static void Main()
{
Declaracoes();

string[] a = new string[3];
/*
a[0] = "1";
a[1] = "2";
a[2] = "3";
*/
InstrucaoIf(a);
}
static void Declaracoes()
{
int a;
Expand Down Expand Up @@ -63,7 +76,7 @@ static void InstrucaoDo(string[] args)
{
texto = Console.ReadLine();
Console.WriteLine(texto);
} while (!string.IsNullOrEmpty(texto));
} while (!string.IsNullOrEmpty(texto)); //Isso verifica se o texto é nulo ou vazio
}

static void InstrucaoFor(string[] args)
Expand All @@ -76,7 +89,7 @@ static void InstrucaoFor(string[] args)

static void InstrucaoForeach(string[] args)
{
foreach (string s in args)
foreach (string s in args) //Percorre cada string presente no array
{
Console.WriteLine(s);
}
Expand All @@ -103,9 +116,10 @@ static void InstrucaoContinue(string[] args)
{
if (args[i].StartsWith("/"))
{
//O continue chama o próximo laço e não deixa executar a próxima linha
continue;
}

Console.WriteLine(args[i]);
}
}
Expand Down Expand Up @@ -160,6 +174,8 @@ double Dividir(double x, double y)

static void InstrucaoUsing(string[] args)
{
//O using eliminar o objeto criado automaticamente após realizar as operações com ele
//Substitui o método Dispose, do garbage collection
using (System.IO.TextWriter w = System.IO.File.CreateText("teste.txt"))
{
w.WriteLine("Line 1");
Expand Down
27 changes: 0 additions & 27 deletions 03-Classes/.vscode/launch.json

This file was deleted.

42 changes: 0 additions & 42 deletions 03-Classes/.vscode/tasks.json

This file was deleted.

6 changes: 6 additions & 0 deletions 03-Classes/01-Herança/Ponto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ namespace Classes.Herança
{
public class Ponto
{
/*public: membro acessível a qualquer classe do projeto
private: membro acessível somente dentro da classe
protected: somente classes que herdam têm acesso
internal: o acesso é limitado ao assembly atual
*/
public int x, y;
private int distancia;

Expand All @@ -22,6 +27,7 @@ private void CalcularDistancia2()
//Faz alguma coisa...
}

//virtual permite sobrescrever o método
public virtual void CalcularDistancia3()
{
//Faz alguma coisa...
Expand Down
12 changes: 10 additions & 2 deletions 03-Classes/01-Herança/Ponto3D.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
namespace Classes.Herança
{
public class Ponto3D : Ponto
public class Ponto3D : Ponto //Está herdando de ponto, NÃO EXISTE HERANÇA MÚLTIPLA
{
public int z;
public Ponto3D(int x, int y, int z) : base(x, y)

//:base serve para passar os parâmetros recebidos para a classe pai
public Ponto3D(int x, int y, int z) : base(x, y)
{
this.z = z;
CalcularDistancia();
Expand All @@ -13,10 +15,16 @@ public static void Calcular()
{
//Faz alguma coisa...
}

//override sobrescreve o método da classe base
public override void CalcularDistancia3()
{
//Faz outra coisa ...
base.CalcularDistancia3();
}

internal void MetodoInternal(){

}
}
}
5 changes: 5 additions & 0 deletions 03-Classes/02-Metodos/01-Ref.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ static void Inverter(ref int x, ref int y)
public static void Inverter()
{
int i = 1, j = 2;

//Ao passar via ref, o método Inverter irá alterar os valores declarados nesse método;
//Com o ref as funções apotam para o mesmo local da memória
Inverter(ref i, ref j);

//$"{var}": concatena string com variável
System.Console.WriteLine($"{i} {j}"); // Escreve "2 1"
}
}
Expand Down
3 changes: 3 additions & 0 deletions 03-Classes/02-Metodos/02-Out.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ namespace Classes.Metodos
{
public class Out
{

//O out define variáveis que serão preenchidas no método a ser chamado
//Assim, o método que está requisitando conseguirá obter o valor das variáveis
static void Dividir(int x, int y, out int resultado, out int resto)
{
resultado = x / y;
Expand Down
Loading