C# array accessiblity -


is there way prevent reinitialization of array? (to force specific length)

example initial:

int[] array = new int[3]{0,0,0}; 

usage:

array = new int[5]{1,2,3,4,5}; 

the above usage reinitialize array length of 5.

the array have 3 elements, values of elements changing.

i trying avoid doing following assign it's values:

array[0] = 1; array[1] = 2; array[2] = 3; 

try declaring readonly:

readonly int[] array = new int[3]{0,0,0}; 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -