I’ve been looking for a decent definition of static arrays. I’ve tried using msdn and c# sources but cannot seem to find a definition. It gives examples, but no definitions…
Does anyone know any links or definitions and characteristics of a static array please?
When you talk about a ‘static array’ you are really talking about two separate things.
One would be the
statickeyword. When applied to variables this means that the variable lives at theclasslevel, and each object of that type will not get its own instance.An
arrayis simply a data structure for holding multiple values of some type.So, a
static arrayis simply an array at the class level that can hold multiple of some data type.For example:
In your
TravelRouteclass, you may have a set number of possible destinations in a route. These could be defined like so:This will define the possible destinations on a
TravelRoute. You can then access the array like so: