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

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -