简体   繁体   English

Visual Studio 2012中的SDK

[英]SDKs in Visual Studio 2012

I am brand new to Visual Studio. 我是Visual Studio的新手。 I have been coding in Java for many years but have taken on a project which requires me to use c# and visual studio 2012. 我从事Java编程已经很多年了,但是接受了一个项目,该项目要求我使用c#和Visual Studio 2012。

What I need to know is how to utilize a different SDK. 我需要知道的是如何利用其他SDK。 I want to use something called Honeywell SDK instead of Visual Studios inherent SDK but I cannot find out where to change this setting. 我想使用霍尼韦尔SDK代替Visual Studios固有的SDK,但是我找不到更改此设置的位置。 If anyone has an answer that would be greatly appreciated! 如果有人有答案,将不胜感激!

as a Java developer you are probably used to imports and presumably understand how to use the import statement to import the classes in a namespace. 作为Java开发人员,您可能习惯于导入并且大概了解如何使用import语句在命名空间中导入类。

In C#, the first thing you must do is add a reference to the library containing the methods you require - this is normally done by right clicking your project in Solution Explorer, clicking add reference, and then selecting browse to browse to the location what is normally a DLL containing the library methods in question. 在C#中,您必须做的第一件事是向包含所需方法的库添加引用-通常通过在解决方案资源管理器中右键单击您的项目,单击“添加引用”,然后选择“浏览”以浏览到该位置来完成此操作。通常是包含相关库方法的DLL。

Once you have added a reference to your project, you can access the classes in the library either using a fully qualified name, eg to access the Thread class in .NET's System.Threading namespace for example, fully qualified use would be as follows: 一旦添加了对项目的引用,就可以使用完全限定的名称来访问库中的类,例如,访问.NET的System.Threading命名空间中的Thread类,例如,完全限定的用法如下:

System.Threading.Thread thread = new Thread();

Alternatively, you can put a using directive at the top of each file where you intend to use the client to avoid the need for the fully qualified name. 另外,您可以在每个要使用客户端的文件的顶部放置一个using指令,以避免需要完全限定的名称。 For example: 例如:

using System.Threading;

Then in code, you can simply use the shortened version of the class name by itself: 然后在代码中,您可以简单地单独使用类名的缩写形式:

Thread thread = new Thread();

As you can see, the using directive is effectively C#'s equivalent of Java's import directive. 如您所见,using指令实际上与Java的import指令等效于C#。 Note that to import all classes in a namespace you do not need the .* wild card at the end of the using directive as you do an equivalent Java import statement. 请注意,要在名称空间中导入所有类,在执行等效的Java import语句时,在using指令的末尾不需要。*通配符。

In practice, you may need to refer to the documentation you have to confirm what namespaces they use, and what files you need to add references to to use their libraries as this detail will be vendor specific. 实际上,您可能需要参考文档,以确认它们使用哪些名称空间,以及需要添加引用以使用其库的哪些文件,因为此详细信息是特定于供应商的。 For more detail and a more thorough explanation of the using directive then the MSDN documentation is likely to be the most helpful source: 有关use指令的更多详细信息和更彻底的解释,则MSDN文档可能是最有用的资源:

http://msdn.microsoft.com/en-gb/library/sf0df423%28v=vs.80%29.aspx http://msdn.microsoft.com/en-gb/library/sf0df423%28v=vs.80%29.aspx

and: 和:

http://msdn.microsoft.com/en-gb/library/z2kcy19k%28v=vs.80%29.aspx http://msdn.microsoft.com/en-gb/library/z2kcy19k%28v=vs.80%29.aspx

There is no inherent SDK per-se in a .NET project, though normally references to the .NET framework and default using directives will be added. 尽管通常会引用.NET框架并添加默认的using指令,但.NET项目中本身并没有固有的SDK。 You will probably find these useful as they contain core functionality and the references normally added by default in a new project will provide you access to things such as collections and so forth. 您可能会发现它们很有用,因为它们包含核心功能,并且通常默认情况下在新项目中添加的引用将使您可以访问诸如集合之类的内容。

One final note is that C# has a using statement, as well as the using directive, so if searching for additional information on the directive, be careful not to confuse it for the using statement. 最后一点要注意的是C#既有using语句,也有using指令,因此,如果要搜索有关该指令的其他信息,请注意不要将其与using语句混淆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM