I’ve got a very weird project:

I have to convert a message into a string-array and a protocol code and back. The communication layer can only send fields of string. I know, I could serialize, zip and encode as base64 for example. But that’s not an option. Why? That’s top secret. ;) It has to be one string-value per field.

Another constraint is, that there are a lot of different messages. So it would be quite stupid to handcode the “translationroutine” every time. The messages have to be “real” objects and having Intellisense support is a must. Plus performance is not a big issue. That just sounds like using a Registry/AbstractFactory Pattern with heavy reflection.

Well, satisfying these constraint is actually quite simple. All we need is an Attribute marking classes as message representations and another one marking the Properties that should be used to compile the string array. After defining these two attributes it is quite easy to find all the message definitions in an assembly…

Uh, gotta run. More to follow. ;)