© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
32 replies
Fremko

Store different structs in a list?

I have a world that have different types of items, each of these items have data and each type of item has his own struct, i am trying to loop through all the items in a world, but i dont understand how can i store different types of struct in a list.
like i cant add door struct in a window struct list, and if i make
List<object>
List<object>
I would defeat the whole point of using struct to maintain efficiency as this would be stored on the heap
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

Similar Threads

A small help in understanding structs:
C#CC# / help
3y ago
Structs?
C#CC# / help
2y ago
❔ Unsafe Reading different types of structs from a byte array
C#CC# / help
3y ago
✅ (solved) How does a list of structs that all implement an interface live in memory?
C#CC# / help
8mo ago