[英]Visual Studio doesn't recognize functions in my class
I'm using Visual Studio 2010 to write C# code. 我正在使用Visual Studio 2010编写C#代码。 I've added a reference to a class to my Window application solution named BotSuit.
我在Windows应用程序解决方案中为BotSuit添加了对类的引用。
In my code I added: 在我的代码中,我添加了:
using BotSuite;
When I want to use the functions in my class, BotSuite, I need to type this for it to work. 当我想使用我的类BotSuite中的函数时,我需要键入它才能起作用。
ListGold = BotSuite.ImageLibrary.Template.AllImages(source, refpic, 24);
Why can't I just type this? 为什么我不能只输入这个?
ListGold = AllImages(source, refpic, 24);
Try adding a using statement to the top of your file: 尝试在文件顶部添加using语句:
using BotSuite.ImageLibrary.Template;
or 要么
using BotSuite.ImageLibrary;
... ...
Template.AllImages(source, refpic, 24);
In C# your classes exists in namespaces. 在C#中,您的类存在于名称空间中。 You can think of it as of a directory in which compiler can locate your code.
您可以将其视为编译器可以在其中找到代码的目录。 If you want to use a class from one namespace in a class from another namespace you have to let the compiler know where to look for it.
如果要使用一个命名空间中的类,而另一个命名空间中的类,则必须让编译器知道在哪里寻找它。 To do that use the using` keyword.
为此,请使用using`关键字。 It tells the compiler to include code from different namespaces.
它告诉编译器包括来自不同名称空间的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.