C# dataTable with two columns to a new column

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
 public static DataTable UniteDataTableColumns(DataTable dt, String newColumnName, string ColumnName1, string ColumnName2)
            //Summary of the expression
            string expression = "";                             
            expression = String.Format("{0}+'('+{1}+')'", ColumnName1, ColumnName2);           
            //Add aggregated column
            System.Type myDataType = System.Type.GetType("System.String");
            DataColumn dcCol = new DataColumn(newColumnName, myDataType, expression, MappingType.Attribute);
            //Add merge columns
            return dt;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Hilary at November 14, 2013 - 2:55 PM