【发布时间】:2011-10-21 11:21:25
【问题描述】:
不了解类和用法
我有一个VS2010的项目,这个项目有多个类(项目中的子项目) 我正在尝试在类中使用一种方法,就像在本地 winforms 项目中一样 浏览器
using System.Diagnostics;
namespace DataBaseAccess
{
public class Class1
{
string[] lines = System.IO.File.ReadAllLines("names.txt");
public string startgenerationofnames()
{
foreach (string value in lines)
{
Debug.WriteLine(lines);
//call next class with the current value
}
}
}
}
我想使用 winforms 中的这个类,我已经创建了这个类。
DataBaseAccess.Class1 makenames = new DataBaseAccess.Class1();
并且想以正常方式使用它,就像没有课时一样 浏览器
DataBaseAccess.Class1.startgenerationofnames();
除了运行 Debug.WriteLine(lines); 之外,我不期待返回值,也不期待类中的任何东西 我显然无法理解这个基本任务并且已经搜索了好几天了。 感谢您的帮助
【问题讨论】: