我正在研究一个使用大量求和方法的项目的一部分.这些求和方法应用于Datatable
为了测试最佳方法,我使用以下方法
数据结构
class LogParser
{
public DataTable PGLStat_Table = new DataTable();
public LogParser()
{
PGLStat_Table.Columns.Add("type", typeof(string));
PGLStat_Table.Columns.Add("desc", typeof(string));
PGLStat_Table.Columns.Add("count", typeof(int));
PGLStat_Table.Columns.Add("duration", typeof(decimal));
PGLStat_Table.Columns.Add("cper", typeof(decimal));
PGLStat_Table.Columns.Add("dper", typeof(decimal));
PGLStat_Table.Columns.Add("occurancedata", typeof(string));
}
}
Run Code Online (Sandbox Code Playgroud)
以下方法用于填充表格
LogParser pglp = new LogParser();
Random r2 = new Random();
for (int i = 1; i < 1000000; i++)
{
int c2 = r2.Next(1, 1000);
pglp.PGLStat_Table.Rows.Add("Type" + i.ToString(), "desc" + i , c2, 0, 0, 0, " ");
}
Run Code Online (Sandbox Code Playgroud)
以下方法用于计算总和
方法1使用Compute
Stopwatch s2 = new Stopwatch();
s2.Start(); …Run Code Online (Sandbox Code Playgroud) 我正在使用Csharp Linq创建以下报告
我有两张桌子如下
#Users nid pid name 1 1 name1 2 1 name2 #Transactions nid tid location dcode 1 T1 L1 D1 2 T1 L2 D1 2 T2 L1 D1 2 T2 L3 D1
该报告包含
a) columns from users table where nid != pid
b) columns from transactions where tid == T2 and nid = results from a)
c) the combination can have only one top row in result
nid name tid Location
2 name2 T2 L1
the second record … 我已经打开了一个主变形并调用了一个像这样的子形态
Form4 f = new Form4();
f.Owner = this;
f.Show(this);
Run Code Online (Sandbox Code Playgroud)
在form4中,用户选择一个文本文件,其内容将显示在mainform的textBox1中
我正在尝试类似的东西
Owner.textBox1.Text = "file contents";
Run Code Online (Sandbox Code Playgroud)
但它不起作用