Accessing Linked list across modules in C#
I have previously worked with Linked list in C++ where refering link list in different modules using pointer to acxcess the address of it.
What I use to do is after creating the li开发者_如何转开发nked list use to store the address of the Linked list in long format. In another module is same application after type casting the address I am able to reconstruct the linked list.
New if C# world and not able to find a way to implement it. Please help me
Can you not just hold a reference to your Linked List and use it again whenever you need it?
LinkedList mylist = new LinkedList();
Now use mylist
in whatever place you need it, by passing it around, preferrably.
What you probably don't know in C# by default all types except value types (simple types like int, string etc.) are passed in parameters as a reference to the object.
精彩评论