3 ms·
The article doesn't really touch on how this plays with generics, if at all. Anyone know if we can do: public record MktOrder(T currency, int amount)<T> {
by dvt 7y ago
The article doesn't really touch on how this plays with generics, if at all. Anyone know if we can do:
public record MktOrder(T currency, int amount)<T> { }
or
public record MktOrder<T>(T currency, int amount) { }
Would be a bummer if it breaks the idiomatic (and canonical) way of working with generics. In any case, it's a much needed and welcome feature.
- smarks 7y agoYes, records work with generics pretty much the same way they work with classes. You can do public record MktOrder<T>(T currency, int amount) { } var m1 = new MktOrder<USD>(usd, amount);