Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a partial class?

What is and how can it be used in C#.
Can you use the same concept in Python/Perl?

like image 477
MariusCC Avatar asked Nov 17 '08 14:11

MariusCC


1 Answers

A partial type (it doesn't have to be a class; structs and interfaces can be partial too) is basically a single type which has its code spread across multiple files.

The main use for this is to allow a code generator (e.g. a Visual Studio designer) to "own" one file, while hand-written code is put in another.

I've no idea whether Python/Perl have the same capabilities, I'm afraid.

like image 63
Jon Skeet Avatar answered Oct 09 '22 00:10

Jon Skeet