Order a newly created C # array

In C # 3.0, when I pass an array of strings to the method below, will the order that I define them be preserved or are there conditions under which the order can change? Is this documented somewhere that I haven't seen?

CalculateOmniturePageName(new[] { Model.GetOmnitureDomain(), Model.SectionTitle, Model.Title })
+3
source share
2 answers

The order is fixed. The first element is index 0, the next is index 1, etc. It is defined in spec , see section 12.6 .

Expressions initialize the elements of the array in ascending order, starting with the element with a zero index.

The entire (annotated) spec is available as dead trees and is an amazingly easy to read read.

+10

Array, , , . -, , . "" , , . , , , , List < >

0

Source: https://habr.com/ru/post/1757064/


All Articles