Tuesday, August 23, 2016

Partial Classes

  • ASP.NET use partial class to designer and code behind, so button can found in code behind.
  • A single classstruct or interface divide to multiple source code files.
  • Code Generators / designers to separate with user edit to the files, clean framework
  • 2 Developer can work in different source code for a single class.
  • Inherit 2 Interfaces , 1 partial class handle 1 interface.
  • When writing the code, it will have intellisense to not allow you to make duplicate or find the properties in this 2 files.
  • At compile time , these multiple files get combined into a single class.
  • Partial methods
    • private and must have partial keyword.
    • must void.
    • implementation is optional
    • can ref param but not out param

No comments:

Post a Comment