skip to main
|
skip to sidebar
C# Quest for Perfection
Thursday, August 31, 2006
Transforming a List
or an ArrayList collection to a C# regular array
1. From an ArrayList to, say, a string[]:
ArrayList
oldList =
new
ArrayList
();
[...]
string
[] newList = (
string
[]) oldList.ToArray(typeof(
string
));
2. From a List
to an array T[]. This is very simple:
List
<
MyClass
>
oldList =
new
List
<
MyClass
>
();
[...]
MyClass
[] newList = oldList.ToArray();
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
About Me
Ovidiu G. Lazar
View my complete profile
Blog Archive
►
2007
(2)
►
August
(1)
►
February
(1)
▼
2006
(14)
►
December
(1)
►
November
(1)
►
October
(1)
►
September
(7)
▼
August
(4)
Transforming a List or an ArrayList collection to ...
C# Classes Versus Structs
Working with the registry
The Reason Why This Blog Exists
No comments:
Post a Comment