Skip to main content

Timeline for When and why to use Nested Classes?

Current License: CC BY-SA 3.0

9 events
when toggle format what by license comment
Nov 19, 2019 at 10:39 comment added Flater @EsbenSkovPedersen: Your example has some merit, but IMO should only be used in cases where making Inner non-nested and internal doesn't work (i.e. when you're not dealing with different assemblies). The readability hit from nesting classes makes it less favorable than using internal (where possible).
Jun 21, 2017 at 16:24 vote accept mayur rathi
Mar 31, 2016 at 17:45 comment added Esben Skov Pedersen @BenAaronson in this extremely simple case you are right but for more complex examples, too many delegates becomes clumsy.
Mar 31, 2016 at 10:00 comment added Ben Aaronson @EsbenSkovPedersen Well for your example, instead of passing an instance of Outer, you'd pass a Func<int>, which would just be () => _example
Mar 30, 2016 at 16:34 comment added Esben Skov Pedersen @BenAaronson how would you implement a random interface using delegates?
Mar 30, 2016 at 14:40 comment added Ben Aaronson In most cases I'd expect delegates to be a cleaner way of doing what you're showing in the second example
Mar 29, 2016 at 18:39 history edited Esben Skov Pedersen CC BY-SA 3.0
added 530 characters in body
Mar 28, 2016 at 10:46 history edited Esben Skov Pedersen CC BY-SA 3.0
added 8 characters in body
Mar 28, 2016 at 8:12 history answered Esben Skov Pedersen CC BY-SA 3.0