我需要选择json文件。
public void LoadChartData()
{
var ofDialog = new System.Windows.Forms.OpenFileDialog { Filter = @"json (*.json)|*.json" };
if (ofDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{ }
}
不幸的是,此代码的编译返回错误(两次,对于每个 System.Windows.Forms
):
Error CS0234 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
如何处理这个错误?
最佳答案
在您的项目中包含 System.Windows.Forms
程序集(如错误消息所建议的那样)。
转到您的解决方案资源管理器,右键单击您的项目。然后单击添加引用。选择 System.Windows.Forms 并点击OK。
关于c# - 命名空间 'Forms' 中不存在类型或命名空间名称 'System.Windows',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40891243/