OK, how about this? It's not very neat but I think it gives what you're looking for:

1
System.Type.GetType("System.Collections.Generic.List`1")
By on 8/17/2008 12:50 PM ()

Thanks for replying.

That indeed is a workaround that gives a generic type definition (similar to a workaround in my original post, one of many I suppose), but since it does a method call it is still not usable in an attribute. I want to pass the generic type definition as a parameter to a custom attribute.

Method calls, since they may yield a non-constant thing, are not allowed in attributes.

Kurt

By on 8/18/2008 1:14 AM ()

I'm just going to reply to myself here again(sorry). The answer is in Don Syme's recent blog post ([link:blogs.msdn.com] )

1
typedefof<type>

thank you Don!

Kurt

By on 9/2/2008 12:05 PM ()

I'm not quite sure if this is what you need but for what it's worth:

1
typeof<List<_>>

Does that return the type that you're looking for?

By on 8/17/2008 12:42 PM ()

Nevermind, I see the difference now.

1
typeof<List<_>>

just creates a

1
List<System.Object>

and it is not a GenericTypeDefinition.

By on 8/17/2008 12:46 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper