Solved

using API's for programming

Posted on 2006-06-23
2
194 Views
Last Modified: 2011-04-14
Please explain how API(s) can be written and then  used in others modules. please use C# as an example ! thank s
0
Comment
Question by:deersuper
2 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 16973241
Please explain what you are really asking here.  What are you trying to do.  Because your question is Soooooooo broad that it sounds like it may be homework or for a course....
0
 
LVL 2

Accepted Solution

by:
kmaicorp earned 250 total points
ID: 16973268
C# uses managed code, so it's pretty easy to apply API to it. First you would have to create a DLL project, create your classes and compile. Then give the DLL to someone who would use your DLL in their library. Then to use your DLL, all they need to do is add a reference to your DLL from their project, they can then call the methods and instantiat the classes you have in your DLL.

As an example:

Library Class:

namespace MyOwnNamespace
{
  public class Foo
  {
     public void Bar() {  } // Do something
  };
}
Compile this into a DLL, lets say we call it FOO.DLL

Now create a new project (console or window app is fine). In your solution explorer, right click on references and select add new. Then select the browse tab, find your newly created dll (FOO.DLL) and add it. Now you can access the classes in your library calling it out. For exple:
  MyOwnNamespace.Foo myFoo = new   MyOwnNamespace.Foo();

You can add a using statement to the top of your file if you dont want to type the full name of the class.

Good luck!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now