
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 1.03 KB | hits: 11 | expires: Never
convert List<List<object>> to IList<IList<object>>
IList<IList<object>> ret = new List<IList<object>>();
// Or whatever
ret.Add(new List<object>());
IList<IList<object>> p = new List<List<object>>();
List<List<object>> listOfLists = new List<List<object>>();
IList<IList<object>> p = listOfLists;
p.Add(new object[]);
List<object> list = p[0];
var myOriginalList = new List<List<Object>>();
var converted = ((IList<IList<Object>>)myOriginalList.Cast<IList<Object>>().ToList()); // EDIT: Added .ToList() here
IList<IList<object>> list = new List<IList<object>>(); // Works!
static IList<IList<object>> Test()
{
IList<IList<object>> result = new List<IList<object>>();
var item = new List<object>() { "one", "two", "three" };
result.Add(item);
return result;
}
public IList<IList<object>> Fetch(string data)
{
IList<IList<object>> p = new List<IList<object>>();
// add your stuff here
return p;
}
List<List<string>> list = new List<IList<string>>(); // DOES NOT COMPILE!!!!!