Indexer in C sharp.
- by Jacksquad
Hello guys, i got a problem while overloading indexer property.
public class ClassName
{
private int[] a;
private int[] b;
private string[] c;
private string[] d;
public int this[int pos]
{
get{ return a[pos];}
set{a[pos] = value;}
}
public int this[int pos]
{
get{ return b[pos];}
set{b[pos] = value;}
}
public int this[int pos]
{
get{ return c[pos];}
set{c[pos] = value;}
}
public int this[int pos]
{
get{ return d[pos];}
set{d[pos] = value;}
}
}
/* I AM GETTING "Error 1 'Class1 variables' already defines a member called 'this' with the same parameter types" Please suggest me how to implement this?