I am trying to convert a ListItemCollection into a ListItem[].
Here's what I have in my code.
ListItemCollection rank = new
ListItemCollection();
rank.Add(new ListItem("First", "1");
rank.Add(new ListItem("Second", "2");
ListItem[] rankArray = new
ListItem[4];
rankArray = (ListItem[])rank;
Does a collection in C# .NET treats it as an array or another type of collection? I'm a bit confused on collection and an array. Hoping to find fresh ideas, Thanks in advance.
var result = rank.Cast<ListItem>().ToArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With