Search code examples
c#partial-classesportable-class-library

Partial class with portable class library


I have ported a class library to Portable Class Library, this Portable class library is shared between the server code, WPF applications and Silverlight, so far so good

Before porting I had a partial class in the Silverlight project to support custom properties only relevant in that application, but now I am unable to create partial class with properties.

If I do VS only picks up the properties defined in the partial class and not in the portable class.

So the question is: Is it possible to use Partial classes with Portable class library?


Solution

  • You cannot extend a class from a different assembly. Partial classes only work for multiple fragments of a single class in the assembly being built. It sounds like the class is now in a separate dll: you can't extend that via partial classes.

    Maybe encapsulate the class instead.