C#:类型或命名空间名称“属性”无法找到(您是否缺少 using 指令或程序集引用?
我正在编写我的程序,突然我得到以下信息:
找不到类型或命名空间名称“?属性”(您是 缺少 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
引用
?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.