Пример #1
0
        internal TypedDataFrame(DataFrame inner) : base(inner)
        {
            Column inner1;

            inner.TryGetColumnTranslated(0, out inner1);
            Column1 = new TypedColumn <TCol1>(inner1);
        }
Пример #2
0
        /// <summary>
        /// Converts the column to a typed column of the given type.
        ///
        /// Throws if the conversion isn't allowed.
        /// </summary>
        public TypedColumn <T> Cast <T>()
        {
            if (!OnDiskType.CanMapTo(typeof(T), Parent.Metadata.Columns[TranslatedColumnIndex].CategoryLevels))
            {
                throw new InvalidCastException($"Cannot convert {Type.Name} to {typeof(T).Name}");
            }

            var typedColumn = new TypedColumn <T>(this);

            return(typedColumn);
        }