I have a generic class,
class ComputeScalar<T> : IComputeVariable where T : struct
{
// This is why i have to use generics.
ComputeBuffer<T> buffer;
T data;
}
class ComputeArray<T> : IComputeVariable where T : struct
{
// This is why i have to use generics.
ComputeBuffer<T> buffer;
T[] data;
}
and i use this class in a list in another class,
class SomeClass
{
List<IComputeVariable> variables;
}
I created the interface because in C# we can't use generic classes for type parameters. (Right?) What i want to learn is how can i make "data" a member of interface? And during runtime how can i determine type of data? (Data can be any ValueType)