Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

using API's for programming

Posted on 2006-06-23
2
198 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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