Private classes and full type name

This morning I was checking how my Xml serialization code was doing and I stumbled upon a phenomenon I hadn't seen before: the FullName property of Type will return a '+' instead of a '.' when the class is a private class. For testing I had defined some private classes and I set a property to an instance of one of those classes. My Xml serialization code will then add an Xml node with attributes for Assembly name and Type name. When examining the produced Xml, I saw:Type="DALTester.AdapterTester+OrderEntityValidator".

"Hmmm...", I thought. Examining my Xml producing code didn't give me the idea I had done something wrong, as the same code did produce correct type names for other instances and all it did was reading the FullName property of a System.Type object. After a while debugging back and forth it hit me: OrderEntityValidator was a private class! :)

So, if you run into this issue, it's not you nor your code, it's expected behaviour. :)

4 Comments

Comments have been disabled for this content.