How to create a new xml with LINQ var objCars= new[] { new {CarID = 2, CarName = "Ford", Fuel = "Diesel"}, new {CarID = 3, CarName = "Audi", Fuel = "Diesel"}, new {CarID = 4, CarName = "Mercedes", Fuel = "Diesel"}, new {CarID = 1, CarName = "BMW", Fuel = "Diesel"} }; [...]
string s = String.Format("{{ hello to all }}"); Console.WriteLine(s); //prints ‘{ hello to all }’ int i = 42; string s = String.Format("{0}", i); //prints ’42′ int i = 42; string s = String.Format("{{{0}}}", i); //prints ‘{42}’ int i = 42; string s = String.Format("{0:N}", i); [...]
LINQ to DataSet Perform set operations on sequences of DataRow objects. Retrieve and set DataColumn values Obtain a LINQ standard IEnumerable sequence from a DataTable so Standard Query Operatorsmay be called. To use LINQ to Dataset include next namespaces using System.Data; using System.Linq; Step by Step Exemple: Starting with a simple class: class Student { [...]
LINQ (Language integrated Query) string[] numbers = { "0042", "010", "9", "27" }; int[] nums = numbers.Select(s => Int32.Parse(s)).ToArray(); foreach (var num in nums) Console.WriteLine(num); What where LINQ is useful? LINQ to Objects – LINQ to XML – LINQ to SQL – LINQ to DataSet Perform set operations on sequences of DataRow objects. Retrieve and [...]
Startup for LINQ to SQL with C# This walkthrough requires the following: This walkthrough uses a dedicated folder (“c:\linqtest6″) to hold files. Create this folder before you begin the walkthrough. The Northwind sample database. If you do not have this database on your development computer, you can download it from the Microsoft download site. For [...]