Partial class and partial method in C#

Partial class with partial method declaration:

partial class MyPartialClass
{
  ...
  partial void ValidateInput(decimal amount);
}

Partial class with partial method body:

partial class MyPartialClass
{
  ...
  partial void ValidateInput(decimal amount)
  {
    if (amount> 100)
      throw new ArgumentException ("Too Big");
  }
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.