Skip to content

Instantly share code, notes, and snippets.

var personDictionary = new Dictionary<string, Person>();
var me = new Person("Carmel", "Eve");
personDictionary.Add(me.firstName, me);
class Person
{
public readonly string firstName;
public readonly string lastName;
public Person(string firstName, string lastName)
{
this.firstName = firstName;
this.lastName = lastName;
}
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;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HashingEncryptionBlog
{
class Program
{
var favouriteColourDictionary = new Dictionary<Person, string>();
var me = new Person("Carmel", "Eve");
favouriteColourDictionary.Add(me, "orange");
var anotherMe = new Person("Carmel","Eve");
favouriteColourDictionary.ContainsKey(anotherMe);
// 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
);
// Takes a string and writes it out to the console
var outputNumbers = new ActionBlock<string>(
s => { Console.WriteLine(s); }
);
// 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;
});
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());