Re: Generics in CodeDom of .NET 2.0?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Mark (field027_at_idonotlikejunkmail.umn.edu)
Date: 01/20/05


Date: Wed, 19 Jan 2005 23:57:18 -0600

Excellent. This inspired me to dig further, and I succeeded with the
following:

CodeTypeDeclaration newClass = new CodeTypeDeclaration("MyCollectionClass");
newClass.BaseTypes.Add( new CodeTypeReference("Collection",
                                            new CodeTypeReference[] {
                                            new
CodeTypeReference("MyBaseClass")
                                            }));

// This results in code like:

public class MyCollectionClass : Collection<MyBaseClass>
{
    //woo hoo!
}

"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard.caspershouse.com> wrote in
message news:%23UvQtqY$EHA.2568@TK2MSFTNGP11.phx.gbl...
> Mark,
>
> Check the TypeParameters property of the CodeTypeDeclaration class.
It
> represents the type parameters that the type has. I'm pretty sure that
your
> method declaration class instance has the same property exposed as well.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>
>
> "Mark" <field027@idonotlikejunkmail.umn.edu> wrote in message
> news:Oki$HJN$EHA.2112@TK2MSFTNGP14.phx.gbl...
> > I'm looking at the CodeDom namespace in .NET 2.0 class library online
> > (http://msdn2.microsoft.com/library/za6cc751.aspx). I'm not seeing any
> > class that would allow me to create Generics. Any suggestions?
> >
> > Thanks in advance.
> >
> > Mark
> >
> >
>
>