Thirteen Days a Week

  Home  |   Contact  |   Syndication    |   Login
  23 Posts | 0 Stories | 15 Comments | 0 Trackbacks

News

Archives

Post Categories

Tuesday, July 13, 2010 #

I was doing some more work on my validation pipeline component and came across something that I thought was worth mentioning, since I've never noticed it before.

I had just added a resource file to my assembly to store my component's name, description, version, icon, etc and was just about to start writing the code to retrieve these items from the resource file using System.Resources.ResourceManager.  I can never remember how embedded resource files are named once they end up compiled in an assembly, so I fired up Reflector to have a look at the resource name.  I saw my my embedded resource where I expected it, under the Resources folder.  However I noticed something else, an internal class with the same name as my resource file and static properties for each resource it contained.

Apparently when you embed a .resx file, the compiler generates this class automatically for you.  This is probably old news to many people, especially UI developers where working with resource files is more common.  However I thought it was neat and was happy that I no longer have to remember how to use the ResourceManager when I write a pipeline component.