Convert a collection to an array

  • Thread starter Thread starter Magnus
  • Start date Start date
M

Magnus

Hello!

Is there any simple onerowcode to convert a collection to an array?
For example I have two separate tabcontrols with several tabpages.
I want to use Tabcontrol1 but add all tabpages from Tabcontrol2 to this.
I tried with TabControl1.TabPages.AddRange(Tabcontrol2.TabPages) but this don't work.

Regards Magnus
 
Is there any simple onerowcode to convert a collection to an array?
For example I have two separate tabcontrols with several tabpages.
I want to use Tabcontrol1 but add all tabpages from Tabcontrol2 to this.
I tried with TabControl1.TabPages.AddRange(Tabcontrol2.TabPages) but this
don't work.

=======

The type of System.Windows.Forms.TabControl.TabPages is
System.Windows.Forms.TabControl.TabPageCollection. It implements the
System.Collections.ICollection interface. The interace has a CopyTo method
you can use to copy the tabpages to an array to be passed to AddRange.
 
Back
Top