© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•9mo ago•
75 replies
stigzler

✅ Cannot convert List<MyClass> to List<object>

I'm trying to design a custom generic collection editor in Winforms. I'm getting into a bit of a mess with casting the received class type onto a list of objects. I'm not very good with generics, so tried this via List<object>. See my code here:

https://pastebin.com/M2DwziWj

Gives me the attached error (precis: Unable to cast object of type List<SupportApplications> to type List<object>

I'm sure this may be a job for List<T> or something, but I've never really got my head around generics. I know this is me getting some basic principles wrong. Can anyone help with example code?
image.png
Pastebin
public class SupportApplications: object{ public string Name { get;...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

Convert Object to IFropmFile
C#CC# / help
4y ago
✅ Convert List to IList
C#CC# / help
3y ago
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
C#CC# / help
16mo ago
How to convert ValueKind = object to dynamic object?
C#CC# / help
2y ago