简体   繁体   中英

Partial Class in a separate assembly

I have a partial Class "ClassA" in an assembly MyAssembly.

Can I extend this partial class in a separate assembly "MyExtendedAssembly" with the same name "ClassA"

When partial classes are not possible in a separate assembly, is there any other way where we can extend the properties without inheritance?

Thanks

No, partial classes must be in the same assembly. They are only partial in source code. When the code is compiled the compiler finds all the partial parts and combines them at compile time into a single class.

The runtime has no concept of a partial class, only the compiler.

use extension and interface if you dont like inhertance. Partial class are mean to be together in one assembly like a partner in a family. ^^,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM