Ricky Payne Ricky Payne - 1 month ago 9
C# Question

How to link to a header file in a C# using Visual Studio

I am just getting started with visual studio and have begun a C# project. I was wondering how I can link to a specific header file/library using visual studio or whether that is possible or not.

What I want is to be able to include a file by browsing for it and to have it appear in the using headers automatically. Any ideas?

Answer

In C# you don't have header files. If you are trying to use some C++ code in your application, you need to create a wrapper dll for it. More on this here

If you want to use a library (dll file) in your project you need to reference it to your project.

  1. In Solution Explorer find your project and open it up
  2. Right click on the References item.
  3. Select Add Reference

Here you can add a reference to a project in the same solution, or select browse on the left side to find the concrete dll you want to use.