Array Initializer

noun

say it: “uh-RAY ih-NISH-uh-ly-zer” /əˈreɪ ɪˈnɪʃəlaɪzər/

Curly braces with values that fill an array as it is created, like { 21, 14, 35 }.

What is Array Initializer in C#?

Array Initializer — A brace-enclosed list of values used to fill an array when it is created.

class Route
{
    string[] stops = { "Oak", "Pine", "Lake" };
    string secondStop = "Pine";
    int stopCount = 3;
}

In a sentence

  • “I filled the scores with an array initializer instead of setting each one.”

Level: Apprentice · More C# terms at this level

Updated

In other subjects