Class declared inside of another class in C#

前端 未结 7 1261
庸人自扰
庸人自扰 2021-02-02 06:12

I am working on some legacy code and have come across something that I\'m not sure of. We have a class y that is declared inside of another class x.

7条回答
  •  甜味超标
    2021-02-02 06:47

    I just went through code that I am updating (and I originally wrote) and removed all nested classes. Unfortunately, I originally used the nested class outside of the class it was defined in. Moving nested classes out made a huge difference to me because I originally had bad design.

    If Y is only used in X and will never be used outside of X, I'd say keep it there

提交回复
热议问题