You cannot initialize a non-static member field in C++/CLI (same rules as in standard C++). I suppose you're trying to do the equivalent of this C# code :
class Test
{
int[] arr = new int[10];
}
But if you look at the compiled IL, you'll see that the C# compiler has generated this code in the constructor :
{
...
this.arr = new int[10];
...
}
So unfortunately you have to do it as you do now :
ref class Ref
{
array<int>^ arr;
public:
Ref()
{
arr = gcnew array<int>(10);
}
};