This[r, c] saw this in some C# code, how is it possible?

  • C#
  • Thread starter NotASmurf
  • Start date
  • Tags
    Code
  • #1
150
2
Hey all, I was looking at some example code where they said "this[r, c] = sourceMatrix[r, c];"
where sourcematrix is double[][] but its in a custom local class, the code runs and works. but I am confused as to what "this[r, c]" does, how can a custom class be an array of doubles at the same time?? Any help appreciated.
 
  • #2
Sorry nevermind, seems you can overload c# keywords now.
Code:
 public double this[int row, int col]
        {
            get
            {
                return this.matrix[row, col];
            }
            set
            {
                this.matrix[row, col] = value;
            }
        }
 
  • Like
Likes harborsparrow and WhatHitMe

Suggested for: This[r, c] saw this in some C# code, how is it possible?

Replies
12
Views
902
Replies
11
Views
627
Replies
7
Views
718
Replies
1
Views
828
Replies
2
Views
540
Replies
9
Views
1K
Replies
30
Views
2K
2
Replies
60
Views
2K
Back
Top