Unlike Java, classes containing C # are nested. There is no relation between the contained instance of the class and the instance of the contained class. The contained classes are used only in C # to control the accessibility of the contained class and to eliminate polluting namespaces.
(Some companies have a coding standard that each class should include in its own file; the classes contained are a path that is suitable for small classes.)
In Java, an instance (object) of an inner class returns a pointer to an outer class. This was done in Java, as it uses many small classes to handle events, etc. C # has delegates for this.
(The classes contained were one of the experimental ideals in Java that everyone liked, but did not actually prove the test of time. Since C # came much later, he could learn from Java that it didnβt work out well)
source share