Advantages and disadvantages of usercontrol in asp.net

后端 未结 3 805
有刺的猬
有刺的猬 2021-01-15 00:06

Can some one please tell me if I should use user controls in my project as much as I can? Ff so why and if not why not?

3条回答
  •  孤城傲影
    2021-01-15 00:24

    User controls are good for the same reasons that subroutines/functions/methods are good: code (and markup) re-use.

    Like subroutines, controls can be a problem if they do things like modify global state, make lots of DB or other off-box calls that aren't always needed, introduce unavoidable synchronous blocking, etc. They can also add an unnecessary layer of complexity if they are never re-used.

提交回复
热议问题