c# override [] bracket array allocator

I want to override this operator and I can't find how to do it. I want to, wherever an array of a specific class is going to be initialized to run a c++ code, since that class is wrapped.

Any help? Thanks!

Jon Skeet
people
quotationmark

I want to, wherever an array of a specific class is going to be initialized to run a c++ code, since that class is wrapped.

No, you can't do that. The array will always be an array of references to instances of the class, always initialized with null values unless an array initializer is provided.

You might want to consider providing an alternative wrapper collection yourself, e.g.

FooArray foos = new FooArray(10);

... then you could implement that however you want to.

people

See more on this question at Stackoverflow