In order to use an instance of your class with indexes (pretty much like any collection in the framework), you need to have a property that will act like the index manager.
Here is a simple code of a class that behaves like an array:
public class MyIndexedClass
{
private string[] _values = new string[]
{
"hello",
"hi",
"good morning",
"long time no see"
};
public string this[int index]
{
get
{
Console.WriteLine("Index called with argument value " + index);
return _values[index];
}
set
{
Console.WriteLine("Index called with argument value " + index + " and value " + value );
_values[index] = value;
}
}
}
In my example, using the code myIndexedClassInstance[0];
returns a string containing "hello".
I'm guessing your "Mezo" class contains a jagged array inside of it, but not using the "this" keyword.
You can check more about indexes here.
EDIT:
Updated now given the new info about your Mezo class, the code that is giving you the error should look like this:
if (mezo.mezo[i, j] == 1)
{
SW.WriteLine(i.ToString(), j.ToString());
}
Because you are passing an instance of Mezo, which is the one containing the array called mezo. You cannot use the instance of the class itself as if it was the jagged array property.