Category Archives: Linq

Generate random number using Linq

In below example, we will show how to generate random number using Linq in C# public static string RandomString(int length) { const string chars = “ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789”; var random = new Random(); return new string(Enumerable.Repeat(chars, length) .Select(s => s[random.Next(s.Length)]).ToArray()); }

Linq with an example

LINQ (Language Integrated Query) Designers over the world have experienced issues in querying because they have to master on multiple querying languages such as SQL, Web Administrations, XQuery, and so forth. In Visual Studio 2008 an inbuilt querying language was incorporated called LINQ(Language Integrated Query) outlined by Anders Hejlsberg. It permits composing queries even without… Read More »

What is LINQ

LINQ(Language Integrated Query) introduced in .NET Framework 3.0(VS 2008).Linq queries are object oriented languages\queries.It enables the query of data from any kind of data source, including databases, XML, List, Array and so on. It offers a compact, expressive, and intelligible syntax for manipulating data. It is required as it bridges the gap between the world… Read More »

LINQ Operators and Lambda Expression

Lambda expression in Linq It is referred as a unique function use to form delegates or expression tree types, where right side is the output and left side is the input to the method. For writing LINQ queries particularly, Lambda expression is used. Where IEnumerable<Product> x = products.Where(p => p.UnitPrice >= 10); IEnumerable<Product> x =… Read More »

PLINQ

PLINQ stands for Parallel Language Integrated Query. It is the parallel implementation of LINQ, in which a query can be executed by using multiple processors. PLINQ ensures the scalability of software on parallel processors in the execution environment. It is used where data grows rapidly, such as in telecom industry or where data is heterogeneous.… Read More »

Advantages and Disadvantages of Linq

Advantages Quick turn around for development Queries can be dynamically Tables are automatically created into class Columns are automatically created into properties Relationship are automatically appeaded to classes Lambda expressions are awesome Data is easy to setup and use Disadvantages No clear outline for Tiers No good way of view permissions Small data sets will… Read More »