I\'m trying to implement duck typing in F# and I spotted that you can have a member constraint in F# generics as follows:
type ListEntryViewModel<\'T wh
To make your original code work:
type ListEntryViewModel< ^T when ^T : (member Name : string)>(model:^T) =
inherit ViewModelBase()
member inline this.Name with get() = (^T : (member Name : string) model)
So you have to mark the member as "inline" and repeat the constraint in the member function.
I agree with Tomas that an Interface-based approach is usually preferred in F#.