コード例 #1
0
        /// <summary>
        /// TODO: Needs better handling of generic collection - should be able to determine element type even if empty
        /// </summary>
        /// <returns></returns>
        public Type GetCollectionElementType()
        {
            var list = (IEnumerable)Value;

            if (list == null)
            {
                return(null);
            }

            var firstItem = new object();

            foreach (object o in list)
            {
                firstItem = o;
                break;
            }
            return(ReflectionUtil.GetActualType(firstItem));
        }
コード例 #2
0
 public IEnumerable <PropertyInfo> Apply(object obj)
 {
     return(Apply(ReflectionUtil.GetActualType(obj)));
 }