Partial methods - CSharp Custom Type

CSharp examples for Custom Type:Partial

Introduction

A partial type may contain partial methods.

These let an auto-generated partial type provide customizable hooks for manual authoring. For example:

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){
        ;
    }

  }
}

Related Tutorials