How do I create a List in a reference?
MyClass classA = new MyClass();
myFuction(new List<MyClass>( ??? ))
How Can I add classA to that new List?
Use
new List<MyClass>() {classA};
For collections, the elements inside the brackets will be executed using the add
method (for "regular classes" they will be interpreted as properties)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With