// creating a DataTable object DataTable table = new DataTable("Employees"); // adding columns to the table table.Columns.Add("Id"); table.Columns.Add("Name"); table.Columns.Add("Salary"); // adding rows to the table table.Rows.Add(1, "John", 5000); table.Rows.Add(2, "Jane", 6000); table.Rows.Add(3, "Mark", 4000); // creating a DataView from the DataTable DataView view = table.AsDataView(); // sorting the DataView by Salary in descending order view.Sort = "Salary desc"; // displaying the sorted data foreach (DataRowView rowView in view) { Console.WriteLine("{0} {1} {2}", rowView["Id"], rowView["Name"], rowView["Salary"]); }Example 2: Filtering a DataTable using DataView. ``` // creating a DataTable object DataTable table = new DataTable("Students"); // adding columns to the table table.Columns.Add("Id"); table.Columns.Add("Name"); table.Columns.Add("GPA"); // adding rows to the table table.Rows.Add(1, "John", 3.5); table.Rows.Add(2, "Jane", 3.8); table.Rows.Add(3, "Mark", 3.2); // creating a DataView from the DataTable DataView view = table.AsDataView(); // filtering the DataView to show only students with GPA > 3.5 view.RowFilter = "GPA > 3.5"; // displaying the filtered data foreach (DataRowView rowView in view) { Console.WriteLine("{0} {1} {2}", rowView["Id"], rowView["Name"], rowView["GPA"]); } ``` Both of these examples use the System.Data namespace which is a part of the .NET Framework Class Library.