Пример #1
0
        /// <summary>
        /// Tries to map this dataframe to a dataframe with four columns of the given type.
        ///
        /// Return true if such a mapping was possible, and false otherwise.
        /// </summary>
        public bool TryMap <TCol1, TCol2, TCol3, TCol4>(out TypedDataFrame <TCol1, TCol2, TCol3, TCol4> dataframe)
        {
            if (ColumnCount < 4)
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[0].CanMapTo(typeof(TCol1)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[1].CanMapTo(typeof(TCol2)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[2].CanMapTo(typeof(TCol3)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[3].CanMapTo(typeof(TCol4)))
            {
                dataframe = null;
                return(false);
            }

            dataframe = new TypedDataFrame <TCol1, TCol2, TCol3, TCol4>(this);
            return(true);
        }
Пример #2
0
        /// <summary>
        /// Tries to map this dataframe to a dataframe with eight columns of the given type.
        ///
        /// Return true if such a mapping was possible, and false otherwise.
        /// </summary>
        public bool TryMap <TCol1, TCol2, TCol3, TCol4, TCol5, TCol6, TCol7, TCol8>(out TypedDataFrame <TCol1, TCol2, TCol3, TCol4, TCol5, TCol6, TCol7, TCol8> dataframe)
        {
            if (ColumnCount < 8)
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[0].CanMapTo(typeof(TCol1)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[1].CanMapTo(typeof(TCol2)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[2].CanMapTo(typeof(TCol3)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[3].CanMapTo(typeof(TCol4)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[4].CanMapTo(typeof(TCol5)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[5].CanMapTo(typeof(TCol6)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[6].CanMapTo(typeof(TCol7)))
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[7].CanMapTo(typeof(TCol8)))
            {
                dataframe = null;
                return(false);
            }

            dataframe = new TypedDataFrame <TCol1, TCol2, TCol3, TCol4, TCol5, TCol6, TCol7, TCol8>(this);
            return(true);
        }
Пример #3
0
        /// <summary>
        /// Tries to map this dataframe to a dataframe with a single column of the given type.
        ///
        /// Return true if such a mapping was possible, and false otherwise.
        /// </summary>
        public bool TryMap <TCol1>(out TypedDataFrame <TCol1> dataframe)
        {
            if (ColumnCount < 1)
            {
                dataframe = null;
                return(false);
            }

            if (!Metadata.Columns[0].CanMapTo(typeof(TCol1)))
            {
                dataframe = null;
                return(false);
            }

            dataframe = new TypedDataFrame <TCol1>(this);
            return(true);
        }