コード例 #1
0
 public static T FindByViewId <T>(this ILayoutContainer root, string viewId)
     where T : LayoutContent
 {
     return(root?.Descendents()
            .OfType <T>()
            .FirstOrDefault(x => x.ContentId == viewId));
 }
コード例 #2
0
 public static bool ContainsChildOfType <T, S>(this ILayoutContainer container)
 {
     foreach (var childElement in container.Descendents())
     {
         if (childElement is T || childElement is S)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
 public static bool ContainsChildOfType <T>(this ILayoutContainer element)
 {
     foreach (var childElement in element.Descendents())
     {
         if (childElement is T)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
        public static bool ContainsChildOfType <T>(this ILayoutContainer element)
        {
            bool flag;

            using (IEnumerator <ILayoutElement> enumerator = element.Descendents().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    if (!(enumerator.Current is T))
                    {
                        continue;
                    }
                    flag = true;
                    return(flag);
                }
                return(false);
            }
            return(flag);
        }
コード例 #5
0
        public static bool ContainsChildOfType <T, S>(this ILayoutContainer container)
        {
            bool flag;

            using (IEnumerator <ILayoutElement> enumerator = container.Descendents().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ILayoutElement current = enumerator.Current;
                    if (!(current is T) && !(current is S))
                    {
                        continue;
                    }
                    flag = true;
                    return(flag);
                }
                return(false);
            }
            return(flag);
        }
コード例 #6
0
 public static bool ContainsChildOfType <T, TS>(this ILayoutContainer container)
 {
     return(container.Descendents().Any(childElement => childElement is T || childElement is TS));
 }
コード例 #7
0
 public static bool ContainsChildOfType <T>(this ILayoutContainer element)
 {
     return(element.Descendents().OfType <T>().Any());
 }