public static bool IsSubset(ServiceNameCollection primaryList, ServiceNameCollection subset) { if ((subset == null) || (subset.Count == 0)) { return true; } if ((primaryList == null) || (primaryList.Count < subset.Count)) { return false; } return (primaryList.Merge(subset).Count == primaryList.Count); }
public static bool IsSubset(ServiceNameCollection primaryList, ServiceNameCollection subset) { bool result = false; if (subset == null || subset.Count == 0) { result = true; } else if (primaryList == null || primaryList.Count < subset.Count) { result = false; } else { ServiceNameCollection merged = primaryList.Merge(subset); //The merge routine only adds an entry if it is unique. result = (merged.Count == primaryList.Count); } return result; }