Partial Types and Methods

Each participant must have the partial declaration. Participants cannot have conflicting members. A constructor with the same parameters, for instance, cannot be repeated.

Partial methods

A partial type may contain partial methods. These let an auto-generated partial type
provide customization hooks for manual authoring. A partial method consists of two parts: a definition and an implementation. Partial methods must be void and are implicitly private.

partial class PaymentForm // In auto-generated file
{
...
partial void ValidatePayment (decimal amount);
}
partial class PaymentForm // In hand-authored file
{
...
partial void ValidatePayment (decimal amount)
{
if (amount > 100)
...
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *