简体   繁体   中英

SDKs in Visual Studio 2012

I am brand new to 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.

What I need to know is how to utilize a different 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. 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.

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.

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:

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. 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. 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.

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:

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

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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