C# convert Object to List

In C#, you can get List like Object type.
This sample will be help you convert object to List

List<Dictionary<String, Object>> list = null;
if ([ListObject] is IEnumerable) {
    list = new List<Dictionary<String, Object>>();
    var enumerator = ((IEnumerable)[ListObject]).GetEnumerator();
    while (enumerator.MoveNext()) {
        list.Add((Dictionary<String, Object>)enumerator.Current);
    }
}

Posted by / November 29, 2013
Posted in
C#