I need to insert a value into an array… ideally I could just start with List<myObj>, but the methods I need to use return myObj[] instead.
I always need to insert a value into the first position, and rather than worm the values already in the array… I came up with the following scheme..
List<myObj> list = array.ToList<myObj>();
if (list.Count > 0 && list != null)
{
list.Insert(0, InsertRecord(myParam)); // InsertRecord() is one of my methods...
}
return list.ToArray();
My question is… is this even remotely efficient? Is there a better way to go about doing what I need to accomplish?
I think you can save some time with