0 c#
static void Main()
{
AppHelper helper = new AppHelper();
// more stuff
}
Run Code Online (Sandbox Code Playgroud)
上面使用csc.exe进行编译,但在运行时抛出NullReferenceException:未处理的异常:System.NullReferenceException:对象引用未设置为对象的实例.在AppHelper..ctor()
public class AppHelper
{
private string connect = System.Configuration.ConfigurationManager.ConnectionStrings["connectionString"].ToString();
public AppHelper()
{
// TODO
}
}
Run Code Online (Sandbox Code Playgroud)
调试器从app.config中找到connectionString但运行可执行的choke.
| 归档时间: |
|
| 查看次数: |
627 次 |
| 最近记录: |