【发布时间】:2010-09-04 09:40:46
【问题描述】:
谁能告诉我这个控制台应用程序是做什么的?实际发生了什么?
另外,有错误。你能修复它们吗?
public class Program
{
static void Main(string[] args)
{
Name n = new Name[5]; // error
n[0] = new Name(0); //error
n[0] = "hgfhf"; //is this possible in this program?
string nam = n[0];
}
}
public class Name
{
private string[] name;
private int size;
public Name(int size)
{
this.name = new string[size];
this.size = size;
}
public string this[int pos] // what does this mean?
{
get
{
return name[pos];
}
set
{
name[pos] = value;
}
}
}
【问题讨论】:
-
请删除 txtspk,它只会让您难以阅读您想说的内容。
-
如果您想使用 StackOverflow,请在您的问题上投入一些精力。我刚刚为您翻译;不要使用“文本”语音,至少尝试使用正确的拼写和标点符号。
-
请详细说明您的问题。
标签: c#