Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
Create a generic list List
where T is only known at runtime
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
LB Elbino
16y
2.8k
1
Reply
Please help,
I have a method that returns an Object. This returned object could be a generic list of 4 or more classes in my code.
i.e the object could be List<class1>, List<class2>, List<class3> etc.
At runtime when I recieve this object, I want to be able to cast it to a list of the appropriate type.
PS. The methods return value is object. The writers of this class that I'm calling basically create a generic list and fill it up, then for reason i cant explain, they cast the list to an object and return is.
The return line is exactly ==> return (object)thegeneicList
How do I go about creating a generic list List<T> where T is only known at runtime
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Connecting to aremote database
Frame index information