该名称在当前上下文中不存在 - 如何解决? [英] The name doesn't exist in the current context - How to resolve?

查看:43
本文介绍了该名称在当前上下文中不存在 - 如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试访问不在当前命名空间中的类时,我还为该类命名空间添加了 using 但仍然收到错误.

When I try to access a class that is not in the current namespace while I also added using for that class namespace but still receive an error.

有一个错误说:

名称AddNewDataFile"在当前上下文中不存在.

The name 'AddNewDataFile' doesn't exist in the current context.

我该如何解决这个错误?

How can I resolve this error?

推荐答案

当您收到 The name does not exist in the current context 时,您可以检查以下选项:

When you receive The name doesn't exist in the current context, you can check for these options:

  • 也许您还没有在作用域中定义具有该名称的变量或成员.
  • 也许您拼错了现有的变量或成员名称.
  • 可能缺少定义该类的命名空间.
  • 也许您的项目需要添加对包含该类型的 dll 的引用.

有关更多信息和示例,请参阅:

For more information and example see:

这篇关于该名称在当前上下文中不存在 - 如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆