|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Getting Array Type From TypeCurrently I am doing the following to find an one dimensional array
type of a type - Type asSingle; Type asArray = Array.CreateInstance ( asSingle , 0 ).GetType ( ); Is there a way to do this without creating an instance? I do not know the array type at design time. Thanks in advance, Gary
Show quote
On 28 Jun 2006 16:21:07 -0700, "gary" <gbre***@gmail.com> wrote: What about (assuming .net 2):>Currently I am doing the following to find an one dimensional array >type of a type - > >Type asSingle; > >Type asArray = Array.CreateInstance ( asSingle , 0 ).GetType ( ); > > >Is there a way to do this without creating an instance? > >I do not know the array type at design time. > > >Thanks in advance, > >Gary asSingle.GetType().MakeArrayType(); Chris Chilvers wrote:
Show quote > On 28 Jun 2006 16:21:07 -0700, "gary" <gbre***@gmail.com> wrote: Superb. Thanks Chris.> > >Currently I am doing the following to find an one dimensional array > >type of a type - > > > >Type asSingle; > > > >Type asArray = Array.CreateInstance ( asSingle , 0 ).GetType ( ); > > > > > >Is there a way to do this without creating an instance? > > > >I do not know the array type at design time. > > > > > >Thanks in advance, > > > >Gary > > What about (assuming .net 2): > > asSingle.GetType().MakeArrayType(); |
|||||||||||||||||||||||