I've moved a class in my project into a class Library in the same solution. I've added a reference in the web project to the class library.
How do I access the methods in the class library?
Make sure the method and class are public and instantiate to use it:
YourClass yourClass = new YourClass();
yourClass.YourMethod();
Or, if your method is static:
YourClass.YourMethod();
Make sure to include the namespace of your class is your target classes using statements, i.e.
using ClassLibrary;
If you're unsure of the namespace of YourClass you can find it within the Class file at the top, directly beneath your using statements. Or you can mouse over the YourClass text in the Visual Studios Editor and then select the namespace by clicking the button that appears.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With