0

ToArray()

When you use this method for collections, what is the name of the new array that you've just made? How do you access it?

26th Jul 2020, 2:26 PM
ANNA TOWNSEND
ANNA TOWNSEND - avatar
2 Answers
+ 2
ToArray() returns an array. storehere = ListToBeConverted.ToArray()
26th Jul 2020, 2:30 PM
Saphal Poudyal
Saphal Poudyal - avatar
+ 1
Here an example with this ToArray() copy method: using System; using System.Collections; ArrayList myAL = new ArrayList(); myAL.Add( "The" ); myAL.Add( "array" ); myAL.Add( "list" ); String[] myArr = (String[]) myAL.ToArray( typeof( string ) );
26th Jul 2020, 3:03 PM
JaScript
JaScript - avatar