简体   繁体   中英

how to make use of code reuse in c#?

I have 1 solution,
2 projects p2p,member,
2 namespaces p2p and member respectively in them,
how do I make use of the class defined in p2p namespace in members main routine?

I am new to c# and have hacked my way till here in 2 days.
I used c# just to port my c++ program to it as it saves lots of time using .NET code

This should tell you how to do what you are looking for:

http://www.daniweb.com/software-development/csharp/threads/34528

Add reference to the p2p project in the member project, then type

using p2p;

at the beginning of your member code

When using visual studio you can add a reference to the p2p project from members. (Right click on the project and select add reference).

After that you can access the members of p2p by prefixing it with the namespace or by adding a using clause to the file you're working in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM