- Jan 15, 2000
- 7,052
- 0
- 0
So here is what I'm essentially trying to do, and I have a distinct feeling I'm thinking about this problem in the wrong way since I can't figure out how to do this in C#.
I have a generic data buffer class, which I'm using to encapsulate the various data types that we support in our program. I want to include a reference to this class in a higher level class which is NOT generic. Right now my constraints are as follows for the generic class:
public class DataBuffer<T> where T : struct
So that only value types are allowed. I'm trying to use this class in a higher level concrete class as follows.
public class Signal
{
private DataBuffer<System.ValueType> m_DataBuffer;
}
The compiler barfs on this. I really have the feeling that I'm thinking about this problem in the wrong way and could use some guidance.
I have a generic data buffer class, which I'm using to encapsulate the various data types that we support in our program. I want to include a reference to this class in a higher level class which is NOT generic. Right now my constraints are as follows for the generic class:
public class DataBuffer<T> where T : struct
So that only value types are allowed. I'm trying to use this class in a higher level concrete class as follows.
public class Signal
{
private DataBuffer<System.ValueType> m_DataBuffer;
}
The compiler barfs on this. I really have the feeling that I'm thinking about this problem in the wrong way and could use some guidance.