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 personDictionary = new Dictionary<string, Person>(); | |
var me = new Person("Carmel", "Eve"); | |
personDictionary.Add(me.firstName, me); |
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
class Person | |
{ | |
public readonly string firstName; | |
public readonly string lastName; | |
public Person(string firstName, string lastName) | |
{ | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} |
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
private class Person : IEquatable<Person> | |
{ | |
public readonly string firstName; | |
public readonly string lastName; | |
public readonly string fullName; | |
public Person(string firstName, string lastName) | |
{ | |
this.firstName = firstName; |
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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace HashingEncryptionBlog | |
{ | |
class Program | |
{ |
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 favouriteColourDictionary = new Dictionary<Person, string>(); | |
var me = new Person("Carmel", "Eve"); | |
favouriteColourDictionary.Add(me, "orange"); |
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 anotherMe = new Person("Carmel","Eve"); | |
favouriteColourDictionary.ContainsKey(anotherMe); |
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
// Seperates each list it is passed into its individual elements and adds each result to the output | |
var separateNumbers = new TransformManyBlock<IList<int>, int>( | |
l => l | |
); |
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
// Takes a string and writes it out to the console | |
var outputNumbers = new ActionBlock<string>( | |
s => { Console.WriteLine(s); } | |
); |
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
// Takes an int and transforms it into an output string, and adds that string to the output | |
var transformNumbers = new TransformBlock<int, string>( | |
n => | |
{ | |
var outputString = $"Number: {n}"; | |
return outputString; | |
}); |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Create a list of lists, comprising of [1,1,1,1,1], [2,2,2,2,2] etc. | |
var batchedNumbers = new List<List<int>>(); | |
for (var i=0; i < 5; i++) | |
{ | |
batchedNumbers.Add(Enumerable.Repeat(i, 5).ToList()); |
OlderNewer