using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Yw.Model; namespace Yw.WinFrmUI { /// /// /// public static class HydroParterInfoExtensions { /// /// 匹配 /// public static HydroSourceInfo Matching(this List allSourceList, List flags) { if (allSourceList == null || allSourceList.Count < 1) { return default; } var sourceList = allSourceList.OrderBy(x => x.Flags.Distinct().Count()).ToList(); return sourceList.Find(x => x.Flags.ContainsC(flags)); } /// /// 匹配 /// public static HydroNodeInfo Matching(this List allNodeList, List flags) { if (allNodeList == null || allNodeList.Count < 1) { return default; } var nodeList = allNodeList.OrderBy(x => x.Flags.Distinct().Count()).ToList(); return nodeList.Find(x => x.Flags.ContainsC(flags)); } /// /// 匹配 /// public static HydroLinkInfo Matching(this List allLinkList, List flags) { if (allLinkList == null || allLinkList.Count < 1) { return default; } var linkList = allLinkList.OrderBy(x => x.Flags.Distinct().Count()).ToList(); return linkList.Find(x => x.Flags.ContainsC(flags)); } } }