You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The StoreItems<StoreItemT> type is a subclass of the "vanilla", StoreItems class which is capable of storing a heterogeneous set of StoreItem instances which can be retrieved via the Get<T> method. It seems like the intention of creating StoreItems<StoreItemT> was to allow the user to control the exact subset of types that could be stored (via StoreItemT), but ultimately it doesn't provide any further implementation and thus the consumer still has to provide T to the Get<T> call each time which could, theoretically, mean I could ask for a T that is not a subset of StoreItemT anyway.
There's actually no way to express exactly what I think was being attempted here in C#/.NET. If the framework wants to provide both then two separate classes are probably the way to go:
StoreItems as it exists today with T Get<T>(string name)
StoreItems<TStoreItem> that doesn't subclass StoreItems and provides its own TStoreItem Get (string name) method.
The text was updated successfully, but these errors were encountered:
The
StoreItems<StoreItemT>
type is a subclass of the "vanilla",StoreItems
class which is capable of storing a heterogeneous set ofStoreItem
instances which can be retrieved via theGet<T>
method. It seems like the intention of creatingStoreItems<StoreItemT>
was to allow the user to control the exact subset of types that could be stored (viaStoreItemT
), but ultimately it doesn't provide any further implementation and thus the consumer still has to provideT
to theGet<T>
call each time which could, theoretically, mean I could ask for aT
that is not a subset ofStoreItemT
anyway.There's actually no way to express exactly what I think was being attempted here in C#/.NET. If the framework wants to provide both then two separate classes are probably the way to go:
StoreItems
as it exists today withT Get<T>(string name)
StoreItems<TStoreItem>
that doesn't subclassStoreItems
and provides its ownTStoreItem Get (string name)
method.The text was updated successfully, but these errors were encountered: