This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MeuProjeto; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace MeusTestes | |
{ | |
[TestClass] | |
public class UtilTestes | |
{ | |
[TestMethod] | |
public void EhPares_TodosElementosPares() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MeuProjeto; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace MeusTestes | |
{ | |
[TestClass] | |
public class UtilTestes | |
{ | |
[TestMethod] | |
public void EhPares_TodosElementosPares() |