C# 方法循环调用自身


public void SaveBaseInfo(string type, StationInfo info, int parentRegionId)
        {
            try
            {
                Action<int, StationInfo> AddRegionAndDevice = (scadaMapping, info2) => { };

                AddRegionAndDevice = (regionId, stationInfo) =>
                {
                    regionId = UpdateDevice(type, stationInfo, regionId);
                    if (stationInfo.Children != null && stationInfo.Children.Count != 0)
                    {
                        foreach (var item in stationInfo.Children)
                        {
                            AddRegionAndDevice(regionId,item);
                        }
                    }
                };

                if (info.Children != null && info.Children.Count != 0)
                {
                    foreach (StationInfo item2 in info.Children)
                    {
                        AddRegionAndDevice(parentRegionId, item2);
                    }
                }
            }
            catch (Exception ex)
            {
                Program.Log.Error(ex);
            }
        }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM