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

  • C/++/#
  • Thread starter NotASmurf
  • Start date
  • #1
146
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 im 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.
 

Answers and Replies

  • #2
146
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

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

  • Last Post
Replies
2
Views
632
Replies
17
Views
3K
Replies
13
Views
1K
  • Last Post
Replies
3
Views
2K
Replies
9
Views
3K
Replies
11
Views
2K
  • Last Post
Replies
3
Views
4K
  • Last Post
Replies
1
Views
2K
Replies
8
Views
3K
  • Last Post
Replies
0
Views
2K
Top