Skip to content

Instantly share code, notes, and snippets.

View aredfox's full-sized avatar
🦊
What does the foxx say?

Yves Schelpe aredfox

🦊
What does the foxx say?
View GitHub Profile
@ericsampson
ericsampson / RecordsCustomEquality.cs
Created October 10, 2020 17:50
C#9 Records with custom Equality
Rec a = new Rec{myInt = 1, myStr = "test"};
Rec b = a;
System.Console.WriteLine(a == b);
public record Rec()
{
public int myInt;
public string myStr;
@jansabbe
jansabbe / keyof.ts
Created June 29, 2017 20:42
Example of using keyof in typescript
function filter<T, K extends keyof T>(obj : T, keys : [K], value: any) : boolean {
return keys.some(key => obj[key] === value);
}
let person = {
name: "bos",
firstName: "jos"
}
filter(person, ['firstName', "namee"], "jos");
@marisks
marisks / Sample.cs
Last active December 9, 2023 13:35
Improved Jimmy Bogard's ValueObject<T> which supports inheritance
// Ordinary
public class SimpleDto : ValueObject<SimpleDto>
{
public string Value { get; set; }
}
// With base class
public abstract class BaseDto<T> : ValueObject<T>
{
public string BaseValue { get; set; }