Partial methods
suggest changePartial method consists of the definition in one partial class declaration (as a common scenario - in the auto-generated one) and the implementation in another partial class declaration.
using System;
namespace PartialClassAndMethods
{
public partial class PartialClass // Auto-generated
{
partial void PartialMethod();
}
public partial class PartialClass // Human-written
{
public void PartialMethod()
{
Console.WriteLine("Partial method called.");
}
}
class Program
{
static void Main(string[] args)
{
PartialClass partial = new PartialClass();
partial.PartialMethod(); // outputs "Partial method called."
}
}
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents