Dynamically Type Casting Array[] 
Author Message
 Dynamically Type Casting Array[]

Hi,

I need to pass two arrays into a function that will return one 2D array. I
can do this using (object[] a, object[] b) but I want the resulting array to
be constructed of the seperate types...

Am I thinking about this wrong ?

This is a helper function to build an ASP Table server control which is
dynamically created using a two dimentiional array. The table will somtimes
contain type Label, sometimes type CheckBox etc...

Thanks



Tue, 07 Jun 2005 04:05:59 GMT  
 Dynamically Type Casting Array[]


Quote:
> Hi,

> I need to pass two arrays into a function that will return one 2D
array. I
> can do this using (object[] a, object[] b) but I want the resulting
array to
> be constructed of the seperate types...

> Am I thinking about this wrong ?

> This is a helper function to build an ASP Table server control which
is
> dynamically created using a two dimentiional array. The table will
somtimes
> contain type Label, sometimes type CheckBox etc...

Do you have to work with arrays? There are usually much better data
structures in .NET than arrays for most purposes.

Using a DataTable would be nice for this because you can easily
merge two tables into one.

-c



Tue, 07 Jun 2005 06:08:31 GMT  
 Dynamically Type Casting Array[]

Hey Chad,

Here is the whole problem...

I am creating my ASP pages dynamically, so I have to add my controls
dynamically. The control structure I need could consist of two columns
that are dynamic in length (meaning I might have 5 "Label Textbox" rows
or 10 depending on user input)

a> Label Label
b> Label Textbox
c> Label DropDownList

I want to write a generic function that returns a control and accepts a
2D array of the type combinations above,...so I thought I needed to be
able to cast the arrays that get passed into my function dynamically
depending on the type, build my 2D array imbedded in my table control
and return that.....

I am I thinkning about this the right way ?

Thanks Chad...

Jacek

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 07 Jun 2005 04:44:40 GMT  
 Dynamically Type Casting Array[]


Quote:

> Hey Chad,

> Here is the whole problem...

> I am creating my ASP pages dynamically, so I have to add my controls
> dynamically. The control structure I need could consist of two columns
> that are dynamic in length (meaning I might have 5 "Label Textbox"
rows
> or 10 depending on user input)

> a> Label Label
> b> Label Textbox
> c> Label DropDownList

> I want to write a generic function that returns a control and accepts
a
> 2D array of the type combinations above,...so I thought I needed to be
> able to cast the arrays that get passed into my function dynamically
> depending on the type, build my 2D array imbedded in my table control
> and return that.....

> I am I thinkning about this the right way ?

I suppose it's ok, but I would recommend not using arrays.

Where do you get this 2D array from in the first place?

-c



Tue, 07 Jun 2005 07:02:47 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. type casting an array ?

2. cast specifies array type (howto solve this?)

3. type casting a static 2d array

4. array issue 'type cast warning'

5. Type Casting between Base and Derived Type (Serialization of objects with Type members)

6. type casting to / from pointers to incomplete data types

7. type casting to / from pointers to incomplete data types

8. cast cstring type to integer type

9. Casting to/from STL types to MFC types

10. Why can't overload type cast to base type (object)

11. dynamically allocating an array of array of...

12. Clean way to const-cast arrays of arrays?

 

 
Powered by phpBB® Forum Software