I am looking for a one liner that transforms List into object[]. It\'s one liner, so I am not interested in solutions such as foreac
List
object[]
foreac
If you don't have Linq (.Net 3.0) then you can use the ConvertAll() and ToArray() methods in List:
List list = new List(); object[] objects = list.ConvertAll(item => (object)item).ToArray();