By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,465 Members | 1,435 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,465 IT Pros & Developers. It's quick & easy.

Ellegant code generation for generics using reflection.

P: n/a
Hi all,
I'm creating code generator for wrappers of some c# classes. With the
introduction of c# 2.0 and generics the following problem arises.
When encountering generic types anywhere inside the assembly, for
example a generic method parameter declared as:


the full name of that parameter type returned by reflection is :

"System.Collections.Generic.List`1[[System.Int32, mscorlib,
Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"

This is probably meant to allow runtime creation of that type using
Emit mechanism, I guess.
For the purpose of code generation is quite impractical, because I have
go through all generic types replacing the `1[...] part with the
desired <...>. Although this is not a complicated task, I am suprised
that there is no built-in functionality meant to do that.

Does anybody know if my task can be acomplished without manual string
operations, or the reason why MS haven't added such methods?

Thanks for any comments.
Konrad Kaczanowski

May 11 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.