Is it possible to have partial classes across projects.
e.g. Project 1 has a Customer Class.
Project2 which is an optional module adds to the customer class by attaching an order class, and utilising the original Customer Class.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You cannot use the
partialkeyword to split the code for a class between projects. Thepartialkeyword is a compiler trick; the compiler will output one single class out of the parts it finds, so all parts of the class must exist with the same binary file. Once the class is compiled, there is no trace left of it being a partial class.If you want to extend an existing class you will either need to inherit it (if it is not sealed), or create your own new class that contains the classes that you wish to combine information from.