Forum Discussion

tomperoni's avatar
tomperoni
New Contributor
14 years ago

Access Contents of a .Net Generic List as a Specific Type



I don't know what the syntax needs to be within C# Script to look at items returned in a generic list as the correct specific type. 











I have a C# .Net assembly method with a signature of:

  public List<PersistableObject> GetItemsByType( Type requestedType)





If I request type Foo via the parameter then I expect to get back a list of Foo objects.

If I request type Nik via the parameter then I expect to get back a list of Nik objects.





The name of the assembly that defines Foo and Nik classes is Px.Data.dll and the namespace is Px.Data. 





Foo and Nik are subclasses of Px.Data.PersistableObject.





The name of the assembly that has the method described above and returns the list of Foo objects is Px.Dss.TestAdapt.dll with a namespace of Px.Dss.TestAdapt





I know that the assemblies are properly setup within CLR Bridge since I can instantiate other objects and invoke methods as well as obtain properties from them.