Skip to content

Instantly share code, notes, and snippets.

View uqmessias's full-sized avatar
🤓
Being a Nerd...

Uilque Messias uqmessias

🤓
Being a Nerd...
View GitHub Profile
private IEnumerable<string> nomes = new List<string>(){ "Uilque", "Lucas", "Luiz", "João", "Pedro", "Antônio" };
public IEnumerable<string> NomesGrandesEmCaixaAltaOrdenados()
{
var nomesGrandesEmCaixaAlta = from n in nomes
orderby n
where n.Length > 5
select n.ToUpper();
return nomesGrandesEmCaixaAlta;
}
private IEnumerable<string> nomes = new List<string>(){ "Uilque", "Lucas", "Luiz", "João", "Pedro", "Antônio" };
public IEnumerable<string> NomesGrandesEmCaixaAltaOrdenados()
{
var nomesGrandesEmCaixaAlta = nomes.Where(n => n.Length > 5)
.OrderBy(n => n)
.Select(n => n.ToUpper());
return nomesGrandesEmCaixaAlta;
}
public string GeraSenhaAleatoria(int tamanhoSenha)
{
char[] possiveisCaracteres = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$&".ToArray();
// criar um IEnumerable<bool> com o total de itens definido tamanhoSenha
string senha = Enumerable.Repeat(true, tamanhoSenha)
// Seleciona, randomicamente, alguns caracteres e retorna um IEnumerable<char> com caracteres aleatórios
.Select(c => possiveisCaracteres[rnd.Next(possiveisCaracteres.Length)])
// Junta todos os caracteres em uma única string
.Aggregate(String.Empty, (current, next) => current.ToString() + next.ToString());
public List<object> TentaConverterListaDeStringParaObjeto(List<string> listaDeStrings)
{
// Não vai compilar
return (List<object>)listaDeStrings;
}
public List<string> TentaConverterListaDeObjetoParaString(List<object> listaDeObjetos)
{
// Não vai compilar
private List<string> nomeFuncionariosSede = new List<string>(){ "Uilque", "Lucas", "Luiz", "João" };
private List<string> nomeFuncionariosFiliais = new List<string>(){ "Maria", "Paula", "Pedro", "Antõnio"};
public void IterarEmDuasListasDoMesmoTipoComForeach()
{
foreach(string funcionario in nomeFuncionariosSede)
{
Console.WriteLine(funcionario);
}
public int[] novoArrayComItensRepetidos(int itemARepetir, int totalItens)
{
return Enumerable.Repeat(itemARepetir, totalItens).ToArray();
}
public int[] novoArraySequencial(int ultimoValor)
{
return Enumerable.Range(1, ultimoValor).ToArray();
}
void Main()
{
Console.WriteLine("Digite um número que represente A:");
string aString = Console.ReadLine();
Console.WriteLine("Digite um número que represente B:");
string bString = Console.ReadLine();
float a, b;
a = float.Parse(aString);
private IEnumerable<string> nomes = new List<string>(){ "Uilque", "Lucas", "Luiz", "João", "Pedro", "Antônio" };
public IEnumerable<string> NomesGrandesEmCaixaAltaOrdenados1()
{
var nomesGrandesEmCaixaAlta = from n in nomes.Where(n => n.Length > 5)
orderby n
select n.ToUpper();
return nomesGrandesEmCaixaAlta;
}
package br.com.uilquemessias.utils;
import android.os.IBinder;
import android.support.test.espresso.Root;
import android.view.WindowManager;
import org.androidannotations.annotations.res.StringRes;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
void Main()
{
FormasGeometricas[] formas = new FormasGeometricas[2];
formas[0] = new Quadrado(3);
formas[1] = new Retangulo(2, 4);
for(int i = 0;i < formas.Length;i++)
{
Console.WriteLine(formas[i].Area());
}