I'm splitting a list of (in this example) approx. 190000 items into chunks of 5000 items.

so instead of: `List<Object>`, count 190000

it becomes: `List<List<Object>>`, Count 28(Count 5000))

I do this with the following code:

```
public static IEnumerable<List<Object>> Split(this IEnumerable<Object> sourceList, int chunkSize)
{            
    int numberOfLists = (sourceList.Count() / chunkSize) + 1;
    List<List<Object>> result = new List<List<object>>();

    for (int i = 0; i < numberOfLists; i++)
    {
        List<Object> subList = new List<Object>();
        subList = sourceList.Skip(i * chunkSize).Take(chunkSize).ToList();
        result.Add(subList);
    }

    return result;
}

```

I call this method (which resides in a helper class) like follows;

```
var chunkList = (IEnumerable<List<MyObjectClass>>)MyHelper.Split(myObjectList, 5000);

```

In the above line I explicitly cast the list, that fails in an InvalidCastException. When i use the as operator like follows;

```
var chunkList = MyHelper.Split(myObjectList, 5000) as IEnumerable<List<MyObjectClass>>;

```

the result is null.

I expected I could use

```
List<List<MyObjectClass>> chunkList = MyHelper.Split(myObjectList, 5000) as List<List<MyObjectClass>>

```

I would like to keep the splitter method as generic as possible. The question is how I can cast the return value correctly. Can someone point out to me how to do this?

Thanks in advance.