2013年12月30日 星期一

[C#] 1-5 partial (type) 版本 與 (method)版本

1.partial (type)
部分型別定義允許類別、結構 (Struct) 或介面等的定義分割成多個檔案。

2.partial(method)
A partial method has its signature defined in one part of a partial type, and its implementation defined in another part of the type. Partial methods enable class designers to provide method hooks, similar to event handlers, that developers may decide to implement or not. If the developer does not supply an implementation, the compiler removes the signature at compile time. The following conditions apply to partial methods:
  • Signatures in both parts of the partial type must match.
  • 宣告的是形式、引述要一樣
  • The method must return void.
  • 方法必須 void 型態
  • No access modifiers are allowed. Partial methods are implicitly private.
  • 不允許存取的修飾字 且都是隱含 private



範例在有實際用到時補上。

沒有留言:

張貼留言