In my framework project I have a class that represents tabs in a content management system. In some framewrok implementations it is desirable to extend this class with defintions of tabs that are specific to that implementation. I had though to do this by changing the CmsTabs class to be partial, like this:
namespace Framework
{
/// <summary>
/// Class containing common CMS Tab names
/// </summary>
public static partial class CmsTab
{
/// <summary>
/// Information Tab
/// </summary>
public const string Information = "Information";
And then creating a class with the same name and namespace in the assembly that implements the framework.
However, when I build the framework assembly, the CmsTabs class appears no longer to be partial - it's members are hidden in the implementing assembly when I add the partial class to that. When disassembled in Reflector, I get this:
public class CmsTab
{...
Is there something I need to do to make it retain its partial status, assuming that it is possible to do what I am trying to do.
Thanks.
You can't have a partial class span assemblies:
All partial-type definitions meant to be parts of the same type must be defined in the same assembly and the same module (.exe or .dll file). Partial definitions cannot span multiple modules.
MSDN On Partial Classes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With