Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

using API's for programming

Posted on 2006-06-23
2
Medium Priority
?
218 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 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

877 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