N
Narshe
I have a custom collection class that looks like this
public class CustomCollection<T> : ICollection<T>, IList<T>,
IEnumerable<T>, IDisposable, ICloneable, IComparer<T>
{....}
I need to know if the type T has implemented a certain interface
ICustomClass.
I can't do
public class CustomCollection<T> where T : ICustomClass,
IColltion<T>......
because then I would need to implement ICustomClass. I just want this
collection class to only have objects in it that implement
ICustomClass.
I figured in the constructor I could check if T is of type
ICustomClass, but I can't figure this out.
I could check when the objects are actually added, but I'd like the
check to happen right when it's created. Compile time would be best.
Any suggestions?
public class CustomCollection<T> : ICollection<T>, IList<T>,
IEnumerable<T>, IDisposable, ICloneable, IComparer<T>
{....}
I need to know if the type T has implemented a certain interface
ICustomClass.
I can't do
public class CustomCollection<T> where T : ICustomClass,
IColltion<T>......
because then I would need to implement ICustomClass. I just want this
collection class to only have objects in it that implement
ICustomClass.
I figured in the constructor I could check if T is of type
ICustomClass, but I can't figure this out.
I could check when the objects are actually added, but I'd like the
check to happen right when it's created. Compile time would be best.
Any suggestions?