Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Use Multidimensional Properties

Multidimension properties let you define property accessor methods that take a non-standard number of parameters.


// mcppv2_property_5.cpp
// compile with: /clr
ref class X {
   double d;
   X() : d(0) {}
   property double MultiDimProp[int, int, int] {
      double get(int, int, int) {
         return d;
      void set(int i, int j, int k, double l) {
         // do something with those ints
         d = l;

   property double MultiDimProp2[int] {
      double get(int) {
         return d;
      void set(int i, double l) {
         // do something with those ints
         d = l;

int main() {
   X ^ MyX = gcnew X();
   MyX->MultiDimProp[0,0,0] = 1.1;
   System::Console::WriteLine(MyX->MultiDimProp[0, 0, 0]);



Community Additions

© 2015 Microsoft