Maybe this post is not necessary, but I still have thought that beginners will struggle with array initialization and C# objects.
Here we go with an Int array first,
Syntax: Type [] <variable>;
I am combining declaration with an assignment of values as follows
int[] x = new int[] { 1, 2 };
Object Array
What about object array? Let’s have a look at the Account Class
class Accounts { public Accounts() { // TODO: Complete member initialization }}
This is a blank class with only one default constructor. We are going to create an array of Accounts with size 2.
Accounts[] ac = new Accounts [] { new Accounts( ), new Accounts( ) };
Here in all these arrays, we have explored the size will be automatically determined while we initialize the values dynamically to some extent.