这段代码编译时说接口不能包含字段 那接口该如何定义
public class aaa{
static void Main(string[] args)
{
IA ia = new A();
A[0] = 1;
Console.Read();
}
}
public interface IA
{
private int[] value;
string this[int index]
{
get
{
return values[index];
}
set
{
values[index] = value;
}
}
}
public class A : IA
{
private int[] values;
string this[int index]
{
get
{
return values[index];
}
set
{
values[index] = value;
}
}
public A()
{
valuses = new int[10];
}
}
}