|
|
|
|
|
by neonsunset
432 days ago
|
|
> I think I can do that in a no overhead way. If 'T' is a struct, yup, although that's specific to the way it is compiled by CoreCLR's JIT or ILC. For constructor semantics it's best to expose a static abstract interface method Create<T> and have the interface be SomeInterface<Self> where Self : ISomeInterface<Self>. For example, that's how `INumber<T>` interface works so you can further down the line write `T.Zero`. |
|
Huh, interesting idea with the `Self` generic dependency for the `Create<T>`. That's an interesting angle I hadn't thought of, thanks.