I have a Linkedlist of objects (can be changed to any other Collection type as long as it keeps entry order) in assembly A (DLL).
When Assembly B creates an object from the class that contains said LinkedList, it assigns a method to report back some information. One of the arguments that the method takes is said LinkedList.
Now i want this method in Assembly B to be able to read from that LinkedList (traverse it and do stuff based on it's content), however i need to prevent that method from changing the data in the List.
While i am the one using Assembly A right now, When and if it goes public, I need to prevent the data from being changed from outside my assembly so that no 3rd party using the library can fidget with results within the assembly.
Basicly i am looking to 'seal' the parameter that brings that LinkedList from Assembly A to Assembly B
Am I making any sense?
new List<T>(linkedList).AsReadOnly();
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