c# .net无限递归获取分类,传统for无限递归和 linq无限递归获取分类

【*重点】 核心业务代码





public string CommonClassList()
{ 
	List<CommonClassModel> list =getList(“获取信息列表”);
	PrimevalDataList.Clear(); //清空缓存
	ReturnDataList.Clear();//清空缓存
	PrimevalDataList = list;//初始化数据
	Recursive(0); //处理数据
	return ReturnDataList; //输出处理后的数据
}

#region 递归渲染列表
/// <summary>
/// 原数据
/// </summary>
private static List<CommonClassModel> PrimevalDataList = new List<CommonClassModel>();
/// <summary>
/// 递归后的结果数据
/// </summary>
private static List<CommonClassBusinessModel> ReturnDataList = new List<CommonClassBusinessModel>();

/// <summary>
/// 【递归深度】 
/// </summary>
private static int RecursiveIndex = 0;

/// <summary>
/// 递归循环
/// </summary>
/// <param name="_BaseID">父级ID</param>
/// <param name="intervalSign">间隔符</param>
/// <param name="markSign">标识符</param>
/// <param name="intervalSignIsTop">间隔符是否在前</param>
private static void Recursive(int BaseID = 0, string intervalSign = "&nbsp;&nbsp;", string markSign = "<span style=\"color:#cccccc;\">&nbsp;&nbsp;&nbsp;&nbsp;└─</span>", bool intervalSignIsTop = true)
{
	RecursiveIndex = BaseID == 0 ? 0 : ++RecursiveIndex;

	//符号初始化
	string _intervalSign = BaseID == 0 ? "" : intervalSign;
	string _markSign = BaseID == 0 ? "" : markSign;

	foreach (var item in PrimevalDataList)
	{
		if (item.ParentId == BaseID)
		{
			CommonClassBusinessModel mode = new CommonClassBusinessModel()
			{
				ClassId = item.ClassId,
				CommonName = item.CommonName,
				ParentId = item.ParentId,
				DisplayOrder = item.DisplayOrder,
				Layer = item.Layer,
				Type = item.Type,
				Status = item.Status,
				ParentName = item.ParentName 
			};

			string _intervalSign2 = _intervalSign;
			for (int i = 0; i < RecursiveIndex; i++)
			{
				_intervalSign2 += (_intervalSign + _intervalSign + _intervalSign);
			}
			if (intervalSignIsTop)
			{
				mode.CommonName2 = $@"{_intervalSign2}{_markSign}{item.CommonName}";
			}
			else
			{
				mode.CommonName2 = $@"{_markSign}{_intervalSign2}{item.CommonName}";
			}


			ReturnDataList.Add(mode);

			int number = RecursiveIndex;
			Recursive(item.ClassId, intervalSign, markSign, intervalSignIsTop);
			RecursiveIndex = number;
		}
	}
}
#endregion
public class CommonClassModel
{
	public int ClassId { get; set; }
	public string CommonName { get; set; }
	//扩展字段 父ID
	public int ParentId { get; set; }
	public int DisplayOrder { get; set; }
	public int Layer { get; set; }
	public int Type { get; set; }
	public int Status { get; set; }

	//扩展字段 父名称
	public string ParentName { get; set; }

}

public class CommonClassBusinessModel: CommonClassModel
{
    //存放递归后的名称
	public string CommonName2 { get; set; }
}

 

一、传统for无限递归获取分类

代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiGui
{
    class Program
    { 
        /// <summary>
        /// 缓存数据
        /// </summary>
        private static List<TypeModel> typeList = null;
        /// <summary>
        /// 递归后的数据
        /// </summary>
        static List<TypeModel> RecursiveTypeList = new List<TypeModel>();


        /// <summary>
        /// 【递归深度】
        /// 如果是2级分类
        /// 一级分类是“手机”
        /// 二级分类是“小米手机”
        /// 递归第一次是“手机”深度是0
        /// 递归第二次是“小米手机”深度是1
        /// 以此类推
        /// </summary>
        static int RecursiveIndex = 0;
        static void Main(string[] args)
        {
            RecursiveEXE();
            Console.Read();
        }

        #region 递归给分类重新排序
        /// <summary>
        /// 递归给分类重新排序
        /// </summary>
        private static void RecursiveEXE()
        {
            typeList = GetList();

            string y = "";
            foreach (var type in typeList)
            {
                y = y + $"{type.ID}+{ type.Name} \n"; 
            }
            Console.WriteLine("源数据:");
            Console.WriteLine(y);


            Recursive(0);
            string s = "";
            foreach (var type in RecursiveTypeList)
            {
                s = s + type.sign+ type.Name + "\n";
            } 
            Console.WriteLine("【递归】后的数据:");
            Console.WriteLine($"{s}");
        }


        /// <summary>
        /// 递归方法
        /// </summary>
        /// <param name="id"></param> 
        private static void Recursive(int id)
        {  
            int a = 0; 
            for (int i = 0; i < typeList.Count; i++)
            {
                TypeModel typeModel = typeList[i];
                if (typeModel.BaseID == id)
                {
                    a = a+1;
                    TypeModel Type = new TypeModel();
                    Type.ID = typeModel.ID;
                    Type.Name = typeModel.Name;
                    Type.BaseID = typeModel.BaseID;

                    if (a == 1 && typeModel.BaseID != 0)
                    {
                       
                        RecursiveIndex = RecursiveIndex + 1;
                    }
                    string sign = "";
                    for (int j = 0; j < RecursiveIndex; j++)
                    {
                        sign = sign + "-";
                    }

                    if (typeModel.BaseID == 0)
                    {
                        RecursiveIndex = 0;
                        sign = "";
                    }

                    Type.sign = sign;
                    RecursiveTypeList.Add(Type);

                    //这里需要声明一个临时变量存储当前递归深度,让这个变量去等待递归;否则,将会覆盖递归深度,造成符号数据错误,也就是 sign变量
                    int temporary = RecursiveIndex;
                    Recursive(typeModel.ID);
                    //当前递归结束后把临时存储的递归深度,赋值给当前深度
                    RecursiveIndex = temporary;
                 
                }  
            }    
        }

        private static List<TypeModel> GetList()
        {
            List<TypeModel> typeList = new List<TypeModel>();

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 1,
                    Name = "手机",
                    BaseID = 0
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 2,
                    Name = "电脑",
                    BaseID = 0
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 3,
                    Name = "小米手机",
                    BaseID = 1
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 4,
                    Name = "小米电脑",
                    BaseID = 2
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 5,
                    Name = "华为手机",
                    BaseID = 1
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 6,
                    Name = "三星手机",
                    BaseID = 1
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 7,
                    Name = "联想电脑",
                    BaseID = 2
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 8,
                    Name = "戴尔电脑",
                    BaseID = 2
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 9,
                    Name = "小米5手机",
                    BaseID = 3
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 10,
                    Name = "小米游戏电脑",
                    BaseID = 4
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 11,
                    Name = "小米5手机壳",
                    BaseID = 9
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 12,
                    Name = "小米游戏电脑壳",
                    BaseID = 10
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 13,
                    Name = "小米5手机壳【白色】",
                    BaseID = 11
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 14,
                    Name = "小米游戏电脑壳【亮光黑】",
                    BaseID = 12
                };
                typeList.Add(typeModel);
            }
            return typeList;
        }
        #endregion
    }

    public class TypeModel
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public Nullable<int> BaseID { get; set; }
        public string sign { get; set; }

    }
}

运行结果:

二、linq无限递归获取分类

代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiGui3
{
    class Program
    {
        /// <summary>
        /// 缓存数据
        /// </summary>
        static List<TypeModel> typeList = GetList();
        /// <summary>
        /// 递归后的数据
        /// </summary>
        static List<TypeModel> RecursiveTypeList =new List<TypeModel>();
        /// <summary>
        /// 【递归深度】
        /// 如果是2级分类
        /// 一级分类是“手机”
        /// 二级分类是“小米手机”
        /// 递归第一次是“手机”深度是0
        /// 递归第二次是“小米手机”深度是1
        /// 以此类推
        /// </summary>
        static int RecursiveIndex = 0;
        static void Main(string[] args)
        {
            
            StringBuilder a = new StringBuilder();
            foreach (TypeModel t in typeList)
            {
                a.Append($"{t.ID}{t.sign}{t.Name}\n"); 
            }
            Console.WriteLine("源数据:");
            Console.WriteLine(a);

           
            //递归后的数据
            Recursive();
            StringBuilder b = new StringBuilder();
            foreach (TypeModel t in RecursiveTypeList)
            {
                b.Append($"{t.sign}{t.Name}\n");
            }
            Console.WriteLine(RecursiveIndex);
            Console.WriteLine("递归后的数据:"); 
            Console.WriteLine(b);


            Console.Read();
        }



        /// <summary>
        /// 递归方法
        /// </summary>
        /// <param name="id"></param> 
        private static void Recursive(int id=0)
        {
            string sign = "";//符号
            List<TypeModel> types = typeList.Where(type => type.BaseID == id).ToList();
            if (types.Count > 0)
            {
                if (types[0].BaseID != 0)
                {
                    RecursiveIndex++;
                } 
            }

            
            for (int i = 0; i < RecursiveIndex; i++)
            {
                sign += "-";
            }

            foreach (TypeModel type in types)
            { 
                type.sign = sign; 
                RecursiveTypeList.Add(type);
                if (type.BaseID == 0)
                {
                    RecursiveIndex = 0;
                    sign = "";
                }
                //这里需要声明一个临时变量存储当前递归深度,让这个变量去等待递归;否则,将会覆盖递归深度,造成符号数据错误,也就是 sign变量
                int i = RecursiveIndex;
                Recursive(type.ID);
                //当前递归结束后把临时存储的递归深度,赋值给当前深度
                RecursiveIndex = i;
            }
           
        }
         

        #region /准备数据
        private static List<TypeModel> GetList()
        {
            List<TypeModel> typeList = new List<TypeModel>();

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 1,
                    Name = "手机",
                    BaseID = 0
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 2,
                    Name = "电脑",
                    BaseID = 0
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 3,
                    Name = "小米手机",
                    BaseID = 1
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 4,
                    Name = "小米电脑",
                    BaseID = 2
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 5,
                    Name = "小米11手机",
                    BaseID = 3
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 6,
                    Name = "小米笔记本电脑",
                    BaseID = 4
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 7,
                    Name = "小米11的手机壳",
                    BaseID = 5
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 8,
                    Name = "小米笔记本plus电脑",
                    BaseID = 6
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 9,
                    Name = "小米11的手机壳【白色】",
                    BaseID = 7
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 10,
                    Name = "小米笔记本plus的电脑外壳",
                    BaseID = 8
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 11,
                    Name = "华为手机",
                    BaseID = 1
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 12,
                    Name = "华为电脑",
                    BaseID = 2
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 13,
                    Name = "华为10手机",
                    BaseID = 11
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 14,
                    Name = "华为10电脑",
                    BaseID = 12
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 15,
                    Name = "华为10手机壳",
                    BaseID = 13
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 16,
                    Name = "华为10电脑壳",
                    BaseID = 14
                };
                typeList.Add(typeModel);
            }

            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 17,
                    Name = "华为10手机壳【黑色】",
                    BaseID = 15
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 18,
                    Name = "华为10电脑壳【银灰色】",
                    BaseID = 16
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 19,
                    Name = "空调",
                    BaseID = 0
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 20,
                    Name = "格力空调",
                    BaseID = 19
                };
                typeList.Add(typeModel);
            }
            {
                TypeModel typeModel = new TypeModel()
                {
                    ID = 21,
                    Name = "美的空调",
                    BaseID = 19
                };
                typeList.Add(typeModel);
            }


            return typeList;
        }
        #endregion
    }

    public class TypeModel
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public Nullable<int> BaseID { get; set; }
        /// <summary>
        /// 符号
        /// </summary>
        public string sign { get; set; }

    }
}

运行结果:


三、无限分类列表-实战代码

效果

封装的递归代码

        #region 递归渲染列表
        /// <summary>
        /// 原数据
        /// </summary>
        private static List<Sys_Menu> PrimevalDataList = null; 
        /// <summary>
        /// 递归后的结果数据
        /// </summary>
        private static List<SysMenuBusinessModel> ReturnDataList = new List<SysMenuBusinessModel>();

        /// <summary>
        /// 【递归深度】 
        /// </summary>
        private static int RecursiveIndex = 0;

        private static void Recursive(int BaseID = 0)
        {
            RecursiveIndex = BaseID == 0 ?0: ++RecursiveIndex;

            //符号 
            string sign = BaseID==0? "": "&nbsp;&nbsp;";
            string BaseSign = BaseID == 0 ? "" : "<span style=\"color:#cccccc;\">&nbsp;&nbsp;&nbsp;&nbsp;└─</span>";

            foreach (Sys_Menu item in PrimevalDataList)
            {
                if (item.BaseID == BaseID)
                {
                    SysMenuBusinessModel mode = new SysMenuBusinessModel()
                    { 
                        Sys_MenuID= item.Sys_MenuID,
                        Name = item.Name, 
                        Sort = item.Sort,
                        BaseID = item.BaseID,
                        LinkUrl = item.LinkUrl,
                        IsLock = item.IsLock,
                        Remark = item.Remark,
                        IsSys = item.IsSys,
                        CreateUserID = item.CreateUserID,
                        CreateUserName = item.CreateUserName,
                        CreateDateTime = item.CreateDateTime,
                        UpdateUserID = item.UpdateUserID,
                        UpdateUserName = item.UpdateUserName,
                        UpdateDateTime = item.UpdateDateTime, 
                    };
                     
                    for (int i = 0; i < RecursiveIndex; i++)
                    {
                        sign += sign;
                    } 

                    mode.BusinessName = $@"{sign}{BaseSign}{item.Name}";
                    ReturnDataList.Add(mode);

                    int number = RecursiveIndex;//存储当前递归深度
                    Recursive(item.Sys_MenuID); 
                    RecursiveIndex = number;
                }
            } 
        }
        #endregion

调用

        public JsonResult JsonList(Sys_Menu model)
        {
            JsonResultModel<SysMenuBusinessModel> resultModel = new JsonResultModel<SysMenuBusinessModel>();

            PrimevalDataList = bll.List(); //获取原始数据
            ReturnDataList.Clear(); //清空结果数据
            Recursive(0);//递归数据
    

            resultModel.count = ReturnDataList.Count;//获取结果数据的数量
            resultModel.code = 0;
            resultModel.msg = "成功";
            resultModel.data = ReturnDataList;//赋值结果数据

            return Json(resultModel, JsonRequestBehavior.AllowGet);
        }

结果模型类

        /// <summary>
        /// JSON结果模型类
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// 
    public class JsonResultModel<T>
    {
        /// <summary>
        ///数据状态一切正常的状态码 0:成功,1:失败
        /// </summary>
        public int code { get; set; } = 1;
        /// <summary>
        /// 状态信息
        /// </summary>
        public String msg { get; set; } = "失败";
        /// <summary>
        /// 数据详情
        /// </summary>
        public List<T> data { get; set; }

        /// <summary>
        /// 数据总条数
        /// </summary>
        public int count { get; set; } = 0;
    }

原始数据模型类 Sys_Menu

/// <summary>
    /// 功能菜单Sys_Menu
    /// </summary>		
    public class Sys_Menu
    {

        /// <summary>
        /// 功能菜单ID
        /// </summary>		
        public int Sys_MenuID
        {
            get;
            set;
        }
        /// <summary>
        /// 菜单名称
        /// </summary>		
        public string Name
        {
            get;
            set;
        }
        /// <summary>
        /// 排序
        /// </summary>		
        public int Sort
        {
            get;
            set;
        }
        /// <summary>
        /// 父ID
        /// </summary>		
        public int BaseID
        {
            get;
            set;
        }
        /// <summary>
        /// 链接地址
        /// </summary>		
        public string LinkUrl
        {
            get;
            set;
        }
        /// <summary>
        /// 是否隐藏0显示1隐藏
        /// </summary>		
        public bool IsLock
        {
            get;
            set;
        }
        /// <summary>
        /// 备注说明
        /// </summary>		
        public string Remark
        {
            get;
            set;
        }
        /// <summary>
        /// 系统默认
        /// </summary>		
        public bool IsSys
        {
            get;
            set;
        }
        /// <summary>
        /// 创建人ID
        /// </summary>		
        public string CreateUserID
        {
            get;
            set;
        }
        /// <summary>
        /// 创建人姓名
        /// </summary>		
        public string CreateUserName
        {
            get;
            set;
        }
        /// <summary>
        /// 创建时间
        /// </summary>		
        public DateTime CreateDateTime
        {
            get;
            set;
        }
        /// <summary>
        /// 修改人ID
        /// </summary>		
        public string UpdateUserID
        {
            get;
            set;
        }
        /// <summary>
        /// 修改人
        /// </summary>		
        public string UpdateUserName
        {
            get;
            set;
        }
        /// <summary>
        /// 修改时间
        /// </summary>		
        public DateTime UpdateDateTime
        {
            get;
            set;
        }
        /// <summary>
        /// 是否删除
        /// </summary>		
        public bool IsDelete
        {
            get;
            set;
        }

    }

结果数据模型类 

    /// <summary>
    /// 菜单业务模型类
    /// </summary>
    public class SysMenuBusinessModel:Sys_Menu
    {
        public string BusinessName { set; get; } //业务名称,递归封装后的名称
    }

四、根据第三示例实现完美封装

递归渲染列表

#region 递归渲染列表
        /// <summary>
        /// 原数据
        /// </summary>
        private static List<Sys_Menu> PrimevalDataList = null;
        /// <summary>
        /// 递归后的结果数据
        /// </summary>
        private static List<SysMenuBusinessModel> ReturnDataList = new List<SysMenuBusinessModel>();

        /// <summary>
        /// 【递归深度】 
        /// </summary>
        private static int RecursiveIndex = 0;

        /// <summary>
        /// 递归循环
        /// </summary>
        /// <param name="_BaseID">父级ID</param>
        /// <param name="intervalSign">间隔符</param>
        /// <param name="markSign">标识符</param>
        /// <param name="intervalSignIsTop">间隔符是否在前</param>
        private static void Recursive(int BaseID = 0, string intervalSign = "&nbsp;&nbsp;", string markSign = "<span style=\"color:#cccccc;\">&nbsp;&nbsp;&nbsp;&nbsp;└─</span>", bool intervalSignIsTop = true)
        {
            RecursiveIndex = BaseID == 0 ? 0 : ++RecursiveIndex;

            //符号初始化
            string _intervalSign = BaseID == 0 ? "" : intervalSign;
            string _markSign = BaseID == 0 ? "" : markSign;

            foreach (Sys_Menu item in PrimevalDataList)
            {
                if (item.BaseID == BaseID)
                {
                    SysMenuBusinessModel mode = new SysMenuBusinessModel()
                    {
                        Sys_MenuID = item.Sys_MenuID,
                        Name = item.Name,
                        Sort = item.Sort,
                        BaseID = item.BaseID,
                        LinkUrl = item.LinkUrl,
                        IsLock = item.IsLock,
                        Remark = item.Remark,
                        IsSys = item.IsSys,
                        CreateUserID = item.CreateUserID,
                        CreateUserName = item.CreateUserName,
                        CreateDateTime = item.CreateDateTime,
                        UpdateUserID = item.UpdateUserID,
                        UpdateUserName = item.UpdateUserName,
                        UpdateDateTime = item.UpdateDateTime,
                    };

                    for (int i = 0; i < RecursiveIndex; i++)
                    {
                        _intervalSign += _intervalSign;
                    }
                    if (intervalSignIsTop)
                    {
                        mode.BusinessName = $@"{_intervalSign}{_markSign}{item.Name}";
                    }
                    else
                    {
                        mode.BusinessName = $@"{_markSign}{_intervalSign}{item.Name}";
                    }


                    ReturnDataList.Add(mode);

                    int number = RecursiveIndex;
                    Recursive(item.Sys_MenuID, intervalSign, markSign, intervalSignIsTop);
                    RecursiveIndex = number;
                }
            }
        }
        #endregion

第一次调用时

PrimevalDataList = bll.List();//从数据库里读取出数据赋值给“原始数据变量”
ReturnDataList.Clear();//把“递归后的结果数据”全部移除
Recursive(0);//执行递归方法


resultModel.data = ReturnDataList;//把“递归后的结果数据”赋值给返回的对象变量

再次调用时

//重新渲染递归符
ReturnDataList.Clear();//把递归后的全部数据移除
Recursive(BaseID: 0, intervalSign: "─", markSign: "└", intervalSignIsTop: false);//重新调用递归,从父级id为“0”开始递归,并且把“间隔符”和“标识符”重新定义,另外把间隔符后置


ViewBag.List = ReturnDataList;//把递归渲染好的数据赋值给返回的对象变量

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

橙-极纪元JJY.Cheng

客官,1分钱也是爱,给个赏钱吧

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值