我有一个 C# 实体列表。我的实体定义如下:
public class Item
{
// the id of an item
public Guid ID { get; set; }
// if this is a child item, the ParentID is the ID of the item that
// this item is a child of
public Guid? ParentID { get; set; }
// If this item does not have a parent, this should be 0.
// Otherwise if it is a child, a level=1
// If it is a grandchild, level=2, etc. …Run Code Online (Sandbox Code Playgroud) c# ×1