-1

C# lets you create an ArrayList using notation like this:

var array = new ArrayList {1, 2, 3, 4, 5}

How can I use that kind of notation for my own class?

For context, my goal is to create a method/constructor that takes a list of either Type or IEnumerable<Type> and concat them all together to make a single List<Type>

Zain Rizvi
  • 23,586
  • 22
  • 91
  • 133

1 Answers1

2

You just need to have an Add(item) method.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
  • Thanks for marking this as a duplicate and pointing me to the right answer. I didn't know the correct term to search for here :) – Zain Rizvi Apr 03 '17 at 21:22