I am writing a library which will use other developers of our company. In the State Machine Base Class, a I want to limit them to If I read I think this is not a very unusual situation. Do not start them automatically Make your base class constructor to take the collection as an argument: So now when called a derived class constructor, then it should call the base object constructor also with the collection object or else it's a Compile time will be error This will ensure that the collection has been started in the constructor and nobody else. If you get a reference to a collection, then you can modify the collection even after adding or removing the collection method. The class is the only thing, if you can only restart it for reading . ReadOnlyCollection & lt; T & gt; Allowed States, etc. Developers need to be successors of this class and set the allowed states.
ReadOnlyCollection & gt; T & gt; Start in the manufacturer of your derivative classes and may not be able to modify it later.
ReadOnlyCollection < T & gt; as a property to read only in the base class, which does not work because it can not be modified in the derivative constructor class.
ReadOnlyCollection & lt; T & gt; ?
public class base class {safe readonly collection someObject; Public base class (collection object) {someObject = object}}
Public category Derivedclass: BaseClass {public DerivedClass (): base (/ * archive object pass here / /) {}}
No comments:
Post a Comment