Partial classes and methods allow you to spread code across different files. This is useful when you use code generation - the generated code is in one file that can get overwritten without a problem, the rest of the code can be changed safely.
As for virtual
- in C#, if you want to override a method, you must use virtual
(or abstract
) in the base class and override
in the overriding class. You can't simply override without them.
If you don't use virtual
/abstract
and override
you are in danger of hiding/shadowing a method, which may or may not be what you want. Using virtual
/abstract
and override
make things explicit and predictable.