IsEnumerableEmpty() public static method

public static IsEnumerableEmpty ( IEnumerable collection ) : bool
collection IEnumerable
return bool
Beispiel #1
0
        /// <summary>
        /// Generate CanExpand and ChildrenGetter delegates from the given property.
        /// </summary>
        /// <param name="tlv"></param>
        /// <param name="pinfo"></param>
        protected virtual void GenerateChildrenDelegates(TreeListView tlv, PropertyInfo pinfo)
        {
            Munger childrenGetter = new Munger(pinfo.Name);

            tlv.CanExpandGetter = delegate(object x) {
                try {
                    IEnumerable result = childrenGetter.GetValueEx(x) as IEnumerable;
                    return(!ObjectListView.IsEnumerableEmpty(result));
                }
                catch (MungerException ex) {
                    System.Diagnostics.Debug.WriteLine(ex);
                    return(false);
                }
            };
            tlv.ChildrenGetter = delegate(object x) {
                try {
                    return(childrenGetter.GetValueEx(x) as IEnumerable);
                }
                catch (MungerException ex) {
                    System.Diagnostics.Debug.WriteLine(ex);
                    return(null);
                }
            };
        }