#634 – Invoking Partial Methods That Have No Implementation

partial method is a method declared in one portion of a partial class and implemented in another.  You can also declare a partial method in one place, but not provide an implementation.

What happens, however, if the class that includes the partial method declaration includes a call to the partial method, but then you never provide the implementation?

For example, assume that we declare Dog.Growl as a partial method in the following file, but then never provide an implemenation of Growl.

    public partial class Dog
        public void BeAggressive()

            // Invoke partial method

            Console.WriteLine("Done being aggressive");

        // Partial method declaration--no implementation here
        partial void Growl();

If you compile this and your code does not include an implementation for the Growl method, the compiler does not complain. It just quietly removes the call to the Growl method.


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: