var lookup = dataTable.Rows.Cast<DataRow>().ToLookup(x => x.Field<int>("ParentId"));
Func<int, Item[]> build = null;
build = n =>
lookup[n]
.Select(dr => new Item()
{
Id = dr.Field<int>("Id"),
Name = dr.Field<string>("Name"),
Children = build(dr.Field<int>("Id")),
})
.ToArray();
var items = build(0);