如何在我的类中创建一个将名称和价格存储为字符串的二维数组?以及如何在不使用对象的情况下从我的表单中访问它?到目前为止,我的课堂上有以下内容。
class Name
{
public string SpecialCakeName()
{
string[,] strSpecialCakeName = new string[4, 2];
strSpecialCakeName[0, 0] = " ";
strSpecialCakeName[0, 1] = " ";
strSpecialCakeName[1, 0] = " ";
strSpecialCakeName[1, 1] = " ";
strSpecialCakeName[2, 0] = " ";
strSpecialCakeName[2, 1] = " ";
strSpecialCakeName[3, 0] = " ";
strSpecialCakeName[3, 1] = " ";
return strSpecialCakeName[0,0];
}
}
但是,我不知道这甚至是正确的方法。另外,如果不使用“Name cakeName = new Name();”之类的东西,我怎么能访问这个数组?以我的形式?