0
Are arrays in C# always objects?
My background is in other languages where arrays are created and accessed by index ( array[0] ) without being treated as objects, and I could swear I've seen this done in c++ or c# somewhere. in particular, the int[] array = new int[5]; rather than int array[5]; is throwing my brain for a loop. So... are arrays always objects in c# or is there a 'simple' context as well?
2 Answers
+ 1
They are objects, and they are pasted by reference, almost everything in c# is a object because is an OO language.
0
There are reference types and value types in c#. Arrays are reference types. Any subclass of object is a reference type.