you can make a class like this:
class MyClass
{
private DataTable dt = new DataTable();
public MyClass()
{
//initialize your table
}
//this is an indexer property which make you able to index any object of this class
public object this[int row,int column]
{
get
{
return dt.Rows[row][column];
}
}
/*this won't work (you won't need it anyway)
* public object this[int row][int col]*/
//in case you need to access by the column name
public object this[int row,string columnName]
{
get
{
return dt.Rows[row][columnName];
}
}
}
and use it like this example here:
//in the Main method
MyClass e = new MyClass();
Console.WriteLine(e[0, 0]);//I added just one entry in the table
ofcourse if you wrote this statement
e[0,0]=2;
it will produce an error similar to this: Property or indexer MyNameSpace.MyClass.this[int,int] cannot be assigned to --it is read only.