Skip to content

Instantly share code, notes, and snippets.

@onlyforbopi
Created July 2, 2021 21:56
Show Gist options
  • Save onlyforbopi/d61282b1433b59164f9f303637a924ab to your computer and use it in GitHub Desktop.
Save onlyforbopi/d61282b1433b59164f9f303637a924ab to your computer and use it in GitHub Desktop.
1. List of anything
You can specify not only custom types. List<int>, List<double>,
List<string> will works as well. If you need to store mixed types -
you need to specify closest base class for all types.
In List<object> can be stored instance of any type.
If you are willing to give away type safety you can use an ArrayList,
which was the only way to use a list of stuff pre generics.
https://stackoverflow.com/questions/9184764/storing-different-types-inside-a-list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment