Ejemplo n.º 1
0
        public static List <TOut> To <TOut>(ListType <T> obj)
        {
            //Check to make sure we can convert
            if (ComponentType.CreateInstance().CanConvertTo(typeof(TOut)))
            {
                return(new List <TOut>(obj.Select(o => o.GetValue <TOut>())));
            }

            throw new ArgumentException(string.Format("can't convert ListType of type {1} to List of type {0} to ", typeof(T), typeof(TOut)));
        }
Ejemplo n.º 2
0
        public static ListType <T> From <TIn>(List <TIn> obj)
        {
            //Check to make sure we can convert
            if (ComponentType.CreateInstance().CanConvertFrom(typeof(TIn)))
            {
                return(new ListType <T>(obj.Select(o => (T)CassandraObject.GetCassandraObjectFromObject(o, typeof(T)))));
            }

            throw new ArgumentException(string.Format("can't convert list of type {0} to ListType of type {1}", typeof(TIn), typeof(T)));
        }