DLL development in C #

Source: Internet
Author: User

This article is intended for C # beginners who do not develop DLL programs. The level is limited. Thank you for your understanding.
C # It is impossible to directly debug F5 when creating a dll library. Generally, DLL creates a new DLL project in winform development. in add reference to solution This step must be done!
next, we will add the main Program project to the DLL project in project-Project dependencies.
add the using declaration to the form used. Using , where is the domain name used by the Code In the DLL file.
after this is done, it cannot be used directly. It should be because the methods in the DLL are all in the class, so we can instantiate the class in the DLL and then call the method in it.

------
common error analysis:
1. Why can't I see the class name or cannot instantiate the class after using is added?
cause: no reference is added ...... This step is easy to forget (at least for me ).
2. What if DLL and winform are separated?
method: Release the release, import the DLL in the winform project, or directly use the release DLL when referencing it.
3. Can I call windows DLL?
A: Yes. Use [dllimport] to import the DLL. This is not a development DLL. You can refer to the Windows API reference.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.