Moar generalization

C# to follow