I have c# file with all contents contained in a namespace LinkedList saved with the name linkedlist.cs . This file doesn't have a main() method. I want to include the content of that file or that namespace in another file.
How can I do that ?
I have c# file with all contents contained in a namespace LinkedList saved with the name linkedlist.cs . This file doesn't have a main() method. I want to include the content of that file or that namespace in another file.
How can I do that ?
Assuming your LinkedList
is in a project called MyLinkedListProject
, you will want to reference this project from the project inheriting it. As stated in the comments by @cdhowie you can then reference the namespace by adding the using LinkedList;
which will reference the namespace.
Depending on the content of linkedlist.cs will depend on how you access it, assuming it contains a class called LinkedList
within the LinkedList
you would access the methods (of the class
using code such as LinkedList.methodName();
(this would work for a static
method, you'd have to instantiate a LinkedList
first if you require an "instance of the object" for the method to work.