Virtual partial methods are new in C# 9. As soon as you add either
virtual
or
override
to a
partial
method, you are required to provide an implementation.
partial method - C# Reference | Microsoft Docs[
^]
In your example, both versions will produce the same compiled output. And it doesn't make any sense to use a
partial
method in a class with only a single part. The only time your first example would make sense would be in a compiler-generated class file, where you wanted to force the user to override the specified method.
public partial class Bar : Foo
{
public override partial void PartialMethodFoo();
}
public partial class Bar
{
}
NB: The use of
partial
in the derived class is entirely unrelated to the use of
partial
on the base class.