Frans Bouma's blog

Generator.CreateCoolTool();

Syndication

News

    Visit LLBLGen Pro's website

    Follow FransBouma on Twitter

    Add to Technorati Favorites

About me

Fun stuff I created

My work

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. :)

Published Monday, February 23, 2004 10:10 AM by FransBouma

Filed under:

Comments

# re: Private classes and full type name@ Monday, February 23, 2004 4:35 AM

Hehe, funny guy :D

Paul Gielens

# re: Private classes and full type name@ Monday, February 23, 2004 4:40 AM

:) Well it costed me 1 hour of my monday morning. :D It can be ofcourse that it was the monday morning blues that caused me not remembering that the class was private (and also that private classes apparently have a '+' instead of a '.' in the full name :))...

Frans Bouma

# re: Private classes and full type name@ Monday, February 23, 2004 9:48 AM

I had the same issue with a public nested class.

Sander Gerz

# re: Private classes and full type name@ Saturday, February 28, 2004 4:39 PM

Frans,

What you're seeing has nothing to do with a class being private. The plus sign (+) is used for nested classes.

-VGA.

VGA

# re: Private classes and full type name@ Saturday, February 28, 2004 5:25 PM

ah thanks :)

Frans Bouma