【发布时间】:2016-11-21 08:49:37
【问题描述】:
我有以下代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Data;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
//Your code goes here
DataTable dt = new DataTable();
dt.Columns.Add("Column1");
dt.Columns["Column1"].DataType = typeof(Int32);
dt.Rows.Add(1);
dt.Rows.Add(2);
dt.Rows.Add(-1);
int a = Convert.ToInt32(dt.Compute("SUM(Column1)", "Column1 < 10"));
Console.WriteLine(a);
}
}
}
它将给 op 为 2,将添加 +ve no 和减去 -ve one 。我需要 4 作为 OP。我的意思是所有的绝对值。怎么做?
【问题讨论】:
-
你在找Math.Abs
标签: c# asp.net datatables