Collection Initializers with Parameter Arrays

suggest change

You can mix normal parameters and parameter arrays:

public class LotteryTicket : IEnumerable{
    public int[] LuckyNumbers;
    public string UserName;

    public void Add(string userName, params int[] luckyNumbers){
        UserName = userName;
        Lottery = luckyNumbers;
    }
}

This syntax is now possible:

var Tickets = new List<LotteryTicket>{
    {"Mr Cool"  , 35663, 35732, 12312, 75685},
    {"Bruce"    , 26874, 66677, 24546, 36483, 46768, 24632, 24527},
    {"John Cena", 25446, 83356, 65536, 23783, 24567, 89337}
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Collection Initializers:
* Collection Initializers with Parameter Arrays

Table Of Contents
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
26 Collection Initializers
27 Looping
36 Casting
46 Methods
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script