How can I define a constructor in an open generic type?
Posted
by
Cort
on Stack Overflow
See other posts from Stack Overflow
or by Cort
Published on 2010-12-23T19:47:23Z
Indexed on
2010/12/23
19:53 UTC
Read the original article
Hit count: 150
I am trying to create on open generic type that has a constructor to be used by derived types, but I either don't know how to do it or it is not possible -- not sure which.
public struct DataType<T> : IDataType {
private T myValue;
private TypeState myState;
private DataType<T>(T initialValue, TypeState state) {
myValue = initialValue;
myState = state;
}
}
Any help much appreciated!
Cort
© Stack Overflow or respective owner