i provide txt file nd my create code ....
class Program
{
static void Main(string[] args)
{
DataTable table = new DataTable("Orders");
table.Columns.Add("Population", typeof(Int32));
table.Columns.Add("State", typeof(string));
table.Columns.Add("City", typeof(string));
table.Columns.Add("InterState", typeof(string));
int[] districtDataD = new int[100];
string[] districtDataG = new string[90];
string[] districtDataM = new string[90];
string[] districtDataA = new string[100];
int i = 0;
Console.WriteLine("Enter FilePath:");
string a = Console.ReadLine();
foreach (string line in File.ReadAllLines(a))
{
if (line == null)
{
break;
}
string[] parts = line.Split('|');
if (parts.Length == 4)
{
districtDataD[i] = int.Parse(parts[0]);
districtDataG[i] = parts[1];
districtDataM[i] = parts[2];
districtDataA[i] = parts[3];
}
DataRow newRow = table.NewRow();
newRow["Population"] = districtDataD[i];
newRow["State"] = districtDataG[i];
newRow["City"] = districtDataM[i];
newRow["InterState"] = districtDataA[i];
table.Rows.Add(newRow);
i++;
var Rows = (from row in table.AsEnumerable()
orderby row["Population"], row["State"],row["City"] ascending
select row);
table = Rows.AsDataView().ToTable();
Console.WriteLine(table);
}
Console.WriteLine();
Console.ReadKey();
}
}