public static IEnumerable<SPWeb> GetWebs(this SPWebCollection source, Func<SPWeb, bool> predicate) { return source.AsSafeEnumerable().Where(predicate); }
/// <summary> /// Returns a collection of <see cref="SPWeb"/> objects that will be disposed by its <see cref="IEnumerator"/>. /// </summary> /// <param name="webs">The <see cref="SPWebCollection"/> that contains the sites to enumerate.</param> /// <returns>An <see cref="IEnumerable{SPWeb}"/> that will dispose each <see cref="SPWeb"/> returned.</returns> public static IEnumerable<SPWeb> AsSafeEnumerable(this SPWebCollection webs) { return webs.AsSafeEnumerable(null); }
public static void ForEach(this SPWebCollection source, Action<SPWeb> action) { source.AsSafeEnumerable().ForEach(action); }
/// <summary> /// Returns a collection of <see cref="SPSite"/> objects that will be disposed by its <see cref="IEnumerator"/>. /// </summary> /// <param name="sites">The <see cref="SPSiteCollection"/> that contains the sites to enumerate.</param> /// <returns>An <see cref="IEnumerable{SPSite}"/> that will dispose each <see cref="SPSite"/> returned.</returns> public static IEnumerable<SPSite> AsSafeEnumerable(this SPSiteCollection sites) { return sites.AsSafeEnumerable(null); }