generic-constraints Questions

3

Solved

I'm aware that C# doesn't have generic wildcards, and that a similar effect can be achieved by generic methods, but I need to use a wildcard in a field and can't work out if there is any way to enc...
Barnwell asked 8/12, 2011 at 7:0

1

Solved

I've been looking into a way to add some duck typing to an F# method. SomeMethod(model:'a) = let someField = model.Test("") Where the parameter coming in has the Test method on it. I've seen n...
Peltate asked 11/11, 2011 at 14:41

1

I know you can write: class GenericClass<T> where T : new() { } to enforce that T has an empty constructor. My Qs are : can you enforce that T has a constructor with a specific type ...
Antibody asked 7/5, 2011 at 7:46

© 2022 - 2024 — McMap. All rights reserved.