当前位置: 首页>>代码示例>>C#>>正文


C# IFrame.GetCopy方法代码示例

本文整理汇总了C#中IFrame.GetCopy方法的典型用法代码示例。如果您正苦于以下问题:C# IFrame.GetCopy方法的具体用法?C# IFrame.GetCopy怎么用?C# IFrame.GetCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFrame的用法示例。


在下文中一共展示了IFrame.GetCopy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Merge

        public IFrame Merge(IFrame frame0, IFrame frame1, Guid newFrameId)
        {
            BasicFrame merged = null;
            if (frame0.RowCount != frame1.RowCount)
            {
                throw new ArgumentException(string.Format("The input frames must have the same number of rows before being merged."));
            }
            if (!(frame0 is BasicFrame))
                throw new ArgumentException(string.Format("Invalid type: must be of type {0}.", typeof(BasicFrame).Name), "frame0");
            if (!(frame1 is BasicFrame))
                throw new ArgumentException(string.Format("Invalid type: must be of type {0}.", typeof(BasicFrame).Name), "frame1");
            if (frame0 == frame1)
            {
                throw new ArgumentException(string.Format("Both input frame parameters represent the same instance.  A frame cannot be merged with itself."));
            }

            BasicFrame baseFrame0 = frame0 as BasicFrame;
            BasicFrame baseFrame1 = frame1 as BasicFrame;

            merged = frame0.GetCopy(newFrameId) as BasicFrame;

            int[] colIndices = new int[baseFrame1.Columns.Count];
            for (int i = 0; i < baseFrame1.Columns.Count; i++)
            {
                string [] existingColNames = merged.ColumnNames;
                DataColumn column = new DataColumn(
                    NamingHelper.MakeUnique(existingColNames, baseFrame1.Columns[i].ColumnName),
                    baseFrame1.Columns[i].DataType);
                colIndices[i] = merged.Columns.Count;
                merged.Columns.Add(column);
            }
            for (int i = 0; i < merged.Rows.Count; i++)
            {
                for (int j = 0; j < colIndices.Length; j++)
                {
                    merged.Rows[i][colIndices[j]] = baseFrame1.Rows[i][j];
                }
            }

            merged.AcceptChanges();
            return merged;
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:42,代码来源:BasicFrameMerger.cs


注:本文中的IFrame.GetCopy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。