free geoip Syntax For Generic Type Declarations In Type Elements - protected virtual void jaysonBlog
in

jaysonKnight.com

Welcome to my corner of the internet

protected virtual void jaysonBlog

A conduit to the voices in my head

Syntax For Generic Type Declarations In Type Elements

I was recently working on implementing a provider based design for a project I'm working on which also happens to make heavy use of generics throughout the provider architecture. The signature of the type to be used in the <providers> section of the config file is MyType<T, V>, however I kept getting the dreaded "Unable to load type 'MyType' from assembly 'MyAssembly'" error when attempting to run the application. After about 30 minutes of wringing my hands wondering what the heck was going on, I remembered that generic types have a different signature when declared in text form. The fix was simple, instead of declaring it as

type="MyAssembly.MyType, MyAssembly"

This needs to be changed to

type="MyAssembly.MyType`2, MyAssembly"

Where the number after the '`' is the number of generic type parameters in the type's signature. It would have been nice if the runtime could have offered a hint like it does in other situations. This may be generics 101 for some, but I'm posting this in hopes it'll save someone else some time if Google picks up the keywords in this post.

Share this post: Submit Syntax+For+Generic+Type+Declarations+In+Type+Elements to Technorati | Submit Syntax+For+Generic+Type+Declarations+In+Type+Elements to del.icio.us | Submit Syntax+For+Generic+Type+Declarations+In+Type+Elements to digg.com | Submit Syntax+For+Generic+Type+Declarations+In+Type+Elements to reddit.com | Submit Syntax+For+Generic+Type+Declarations+In+Type+Elements to DotNetKicks | Add Syntax+For+Generic+Type+Declarations+In+Type+Elements to Live Bookmarks

Comments

 

Erik Lane said:

Giddy Up!  Thanks for the tip.

June 21, 2007 10:16 AM

Leave a Comment

(required)  
(optional)
(required)  
Add

About Jayson Knight

Jayson Knight was clueless to the computer programming world until he took a C++ class in college. The rest is proverbial history. He has been building applications targeting the .Net framework for 7 years, focusing mainly on internet technologies and database driven web application development.

Most recently he left the world of Corporate IT to finish up his degree in Chemistry, with an eye on Medical School and an Anesthesiology residency program. Read this post for more information.

He is also a Community Server MVP: Community Server is the software that runs this site, plus many others on the web. For more information, check out http://csmvps.com.

When he finds time to pry himself away from his computer and university studies, he can be found on the mountain bike trails when it's warm, and on the ski slopes when it's cold.

Copyright © :: JaysonKnight.com
External Content © :: Respective Authors

Terms of Service/Privacy Policy