I have a class (basically a linked list, so let's call it List
) that uses another class to store data (the nodes, so let's call the class Node
). Node
has methods that must be called from List
, but calling them from elsewhere could be messy. I need other parts of my program to use references of Node
, but to change them only through List
.
In C++ I would create another class (let's call it Opaque
) that has a private pointer to Node
and expose some members of Node
, and if this was passed to List
, the pointer to the actual Node
would be "unpacked" and used internally, but in C# I have not thought of a way to hide the reference to the Node
from the rest of the program without also makking it inaccessible to List
.
Is there any way to do it or some C#-specific idiom that has the same functionality?
CLARIFICATION: I would like to make it visible to the List
class only. I already know about the internal
keyword.