I am going through some C# training and am trying to understand the difference between these two List<char>
initializations. I have not had much luck finding a good explanation.
When I debug, both show a count of 5. The first shows a capacity of 5 but the second shows a capacity of 8? When I look at Raw View > Non-public-members > _items, the extra [5],[6],[7]
show a value of 0,'\0'
I would really appreciate some help understanding the differences and why/when I should use each one. Thanks in advance.
var vowels1 = new List<char>(new char[] {'a', 'e', 'o', 'u', 'i'});
var vowels2 = new List<char>(){'a', 'e', 'o', 'u', 'i'};