C#:类型或命名空间名称“属性”无法找到(您是否缺少 using 指令或程序集引用?

发布于 2024-12-18 07:36:56 字数 785 浏览 4 评论 0原文

我正在编写我的程序,突然我得到以下信息:

找不到类型或命名空间名称“?属性”(您是 缺少 using 指令或程序集引用?

我在尝试添加 dll 后得到了它:mshtml

我删除了它,但错误并没有消失。

我得到的另一个错误是:

类、结构或接口成员声明中的标记“(”无效

,并且...

'System.Windows.Forms.MessageBox.Show(System.Windows.Forms.IWin32Window, string)”是一个“方法”,但使用方式类似于“类型”

我尝试关闭 IDE 并重新打开它以查看错误是否消失,但事实并非如此。

感谢任何帮助,谢谢:)

编辑:这是错误来源的示例代码。请注意我的代码中的其他几个项目也有相同的类似错误:

错误位于

如果(网络浏览器1

显示

if (webBrowser1.DocumentText.Contains("Text here"))
                {
                    MessageBox.Show("TText.......");
                }

I was coding my program and out of nowhere I get the following:

The type or namespace name '?Attribute' could not be found (are you
missing a using directive or an assembly reference?

I got it after trying to add the dll: mshtml

I removed it but the error doesnt go away.

Another error I get is:

Invalid token '(' in class, struct, or interface member declaration

and...

'System.Windows.Forms.MessageBox.Show(System.Windows.Forms.IWin32Window,
string)' is a 'method' but is used like a 'type

I tried closing out of the IDE and reopening it to see if the error went away but it didnt.

Any help is appreciated, thanks :)

EDIT: Here is a sample code where the error comes from. Note several other items in my code have the same of similar errors:

The error is in

if (webBrowser1

and

Show

if (webBrowser1.DocumentText.Contains("Text here"))
                {
                    MessageBox.Show("TText.......");
                }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

や莫失莫忘 2024-12-25 07:36:56

引用 ?Attribute 名称表明您的属性声明格式不正确,很可能后跟非 ASCII unicode 字符 - 在出现任何其他错误之前检查您的代码文件中是否存在错误的“[”(左方括号)。

Reference to ?Attribute name suggests you have malformed attribute declaration, most likely followed by non-ASCII unicode character - check your code file for misplaced occurrences of "[" (open square bracket) before any other errors.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文