关于名称空间或dll [英] about namespace or dll

查看:86
本文介绍了关于名称空间或dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

找不到类型或名称空间名称"DataClasses1DataContext"(是否缺少using指令或程序集引用?)

在以下代码中收到此错误

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

am getting this error for the below code

{
DataClasses1DataContext _context = new DataClasses1DataContext();
        
        var dateTime = DateTime.Now.ToString();
        var events = from a in _context.riya()
                    select a;
}



为什么会出现此错误?



why this error arising?

推荐答案

这不是.NET附带的类.这可能是您从一些代码或开发演练文章中借用的自动生成的类,例如:

http://www.devx.com/dotnet/Article/36714/1954 [ ^ ].

如果它存在于某篇文章中,并不意味着它现在应该在您要编译的代码中存在.无论如何,在您的C#代码中,没有任何东西因活动或不同的Designer或Wizards神秘地出现.一切都已声明,可以在代码中找到.如果没有,它将无法编译.就这么简单.

就是说:您在原则上做错了.您不应该遵循任何一种像蒙住眼睛的指示那样的指示.我建议您用自己的双手做所有事情,前提是您完全理解正确的每一行.当您对此感到满意时,各种工具有时会为您提供帮助.不早了.

—SA
This is not a class supplied with .NET. This is probably the auto-generated class you borrowed from some code or development walk-through article, like this one:

http://www.devx.com/dotnet/Article/36714/1954[^].

If it exists in some article, it does not mean it should exist in your code you are trying to compile at this moment. Anyway, in your C# code there is nothing which mystically appears as a result of activity or different Designers or Wizards. Everything is declared and can be found in code. If not, it won''t compile. As simple as that.

That said: you are doing something wrong in principle. You should not follow any kinds of instruction like a blind-folded one. I would advise you do everything with you own hands and only if your perfectly understand every line you right. When you are comfortable with that, all kinds of tool can assist you sometimes. Not sooner.

—SA


其中存在程序集"DataClasses1DataContext"吗?

我想,您尚未添加其中存在DataClasses1DataContext的程序集的引用.
添加相同程序集的引用,然后重试

希望这对您有帮助...
In which assembly "DataClasses1DataContext" exists?

I guess, you haven''t added the reference of assembly in which DataClasses1DataContext exists.
Add reference of same assembly and try again

Hope this might help you...


这篇关于关于名称空间或dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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