I want to do something like the following
public abstract class StaticValue : IRefDynamicValue<RefT>
{
public abstract int get();
public int get(RefT refValue)
{
return get();
}
}
public interface IRefDynamicValue<RefT>
{
public int get(RefT refValue);
}
In my specific case, I'm making a game where I have IRefDynamicValue<Actor>, IRefDynamicValue<Ability>, etc., but I want StaticValue (basically just an int) to be able to serve as any of them (for example an ability parameter).
In general though, the situation is that I have a concrete type that I want to be able to implement a generic interface for any type because it just ignores and never uses the type parameter.
The code above of course isn't possible in C#. Is there a different way to implement this kind of relationship in C#, either through some other trick with generics or just an alternate code structure?