|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how do I search inherit generic Class?I want list of Generic inherited Type in DesignTime It is as follows to try. ----------------------------------------------------------------------------------------------- I made two of the following. public interface ITest<T> public class TestImplement : ITest<Somthing> I wrote following Code in TypeConverter Class ITypeDiscoveryService typeDiscoveryService = context.GetService(typeof(ITypeDiscoveryService)) as ITypeDiscoveryService; Ilist genericInheritList = typeDiscoveryService.GetTypes(typeof(ITest<>)); ----------------------------------------------------------------------------------------------- The result of the expectation I want , is genericInheritList has TestImplement class type. but genericInheritList has no Type. how do I search inherit generic Class? Thank you for your help! Sorry, for my bad english Ken ken wrote:
Show quote > hellow , all You could try (haven't tested it):> > I want list of Generic inherited Type in DesignTime > > It is as follows to try. > > ---------------------------------------------------------------------- > ------------------------- I made two of the following. > public interface ITest<T> > public class TestImplement : ITest<Somthing> > > > I wrote following Code in TypeConverter Class > > ITypeDiscoveryService typeDiscoveryService = > context.GetService(typeof(ITypeDiscoveryService)) as > ITypeDiscoveryService; > > Ilist genericInheritList = > typeDiscoveryService.GetTypes(typeof(ITest<>)); > > ---------------------------------------------------------------------- > ------------------------- > > The result of the expectation I want , is genericInheritList has > TestImplement class type. > > but genericInheritList has no Type. > > how do I search inherit generic Class? IList types = typeDiscoveryService.GetTypes(Type.ReflectionOnlyGetType("ITest`1", false, true)); FB, who thanks you for mentioning ITypeDiscoveryService, as I needed that interface but couldn't find it :) -- ------------------------------------------------------------------------ Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com My .NET blog: http://weblogs.asp.net/fbouma Microsoft MVP (C#) ------------------------------------------------------------------------ |
|||||||||||||||||||||||