Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Jan 29, 2015 #1
    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.
     
  2. jcsd
  3. Jan 29, 2015 #2
    Sorry nevermind, seems you can overload c# keywords now.
    Code (Text):
     public double this[int row, int col]
            {
                get
                {
                    return this.matrix[row, col];
                }
                set
                {
                    this.matrix[row, col] = value;
                }
            }
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: This[r, c] saw this in some C# code, how is it possible?
  1. Critique my C++ code (Replies: 11)

Loading...