Skip to content

Instantly share code, notes, and snippets.

using MeuProjeto;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace MeusTestes
{
[TestClass]
public class UtilTestes
{
[TestMethod]
public void EhPares_TodosElementosPares()
using MeuProjeto;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace MeusTestes
{
[TestClass]
public class UtilTestes
{
[TestMethod]
public void EhPares_TodosElementosPares()
IEnumerable<int> GerarNumerosTriangulares(int n)
{
for (int i = 1; i <= n; i++)
{
var numero = i * (i + 1) / 2;
yield return numero;
}
}
foreach(var numero in GerarNumerosTriangulares(5))
const vetor = [1,2,3];
const vetorModificado = vetor
.map(elemento => {
console.log(elemento);
return elemento;
})
.map(elemento => {
const novoElemento = 2 * elemento;
console.log(novoElemento);
return novoElemento;
var vetor = new int[] {1, 2, 3};
var vetorModificado = vetor
.Select(elemento =>
{
Console.WriteLine(elemento);
return elemento;
})
.Select(elemento => {
var novoElemento = 2 * elemento;
Console.WriteLine(novoElemento);