Reputation: 8461
The project I'm on has many partial classes (meaning the keyword 'partial' has been used) but if they are actually partial to anything or not, I don't know (I wish the compiler would look for the other partial(s) and if none are found throw an error but it's the fact it doesn't throw an error which leads me to my question).
Since I have no way of telling that when a partial class is created whether it has other 'partials' or not lead me to thinking would the partial(s) have to be within the same assembly? Would it be possible to create a partial class outside an assembly via WCF or a web service - I have no idea how it would work at runtime (I guess the compiler would be satisfied as it doesn't appear to care to much) but I can't find anything to explicity state yes or no. Similar questions explain that it shouldn't be used this way, but not actually if it can or can't.
Upvotes: 1
Views: 1234
Reputation: 499062
would the partial(s) have to be within the same assembly?
Yes, they would have to be. That's part of the specification for partials - all parts must be in one assembly.
Would it be possible to create a partial class outside an assembly via WCF or a web service
No - that's not possible.
From §10.2 of the C# 4.0 language specification:
All parts of a partial type must be compiled together such that the parts can be merged at compile-time into a single type declaration.
Upvotes: 6