
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Organizing Your Interface Implementations
|
359
Now you have the interface implemented and your original class definition is still
straightforward. For classes that implement many interfaces, this approach will allow
for a more tightly organized implementation.
Discussion
It should be noted that there is no Microsoft intermediate language (MSIL) indicator
that these are partial classes if you look at your class in Ildasm or Reflector. It will
look just like a normal class by the time it gets to MSIL. Intellisense handles the
merge as well. Since partial types are a language trick, they cannot span assemblies,
as the class needs to be resolved by the compiler. Partial types can be declared in the
same file as well as in separate files, but still must be in the same namespace so the
compiler can resolve it before generating the MSIL.
You can use the partial type support for classes, nested classes, structures, and inter-
faces, but you cannot have a partial enum definition. Partial types can declare sup-
port for different interfaces per partial type. However, single inheritance is still in
force and must be the same or omitted from the secondary partial type. You can see
that in the Solution the partial
TriValue class definition in TriValue.cs you created
does not specify the inheritance ...