Click here to Skip to main content
15,886,788 members
Everything / LINQ

LINQ

LINQ

Great Reads

by Nish Nishant
An ExifReader class in C# that supports custom formatting and extraction. StyleCop compliant code, with demos for WPF and Windows Forms.
by Daniel Vaughan
Create best-in-breed cross-platform MVVM apps using Calcium for Xamarin.Forms.
by Roman Kiss
This article describes a design, implementation and tooling of model driven WorkflowServices logically centralized in the Repository and physically decentralized for their runtime projecting.
by Max Paulousky
This article presents the techniques and caveats of building Silverlight applications that can be notified about database state changes via polling duplex. WSHttp binding and CLR triggers are used to implement the solution as well.

Latest Articles

by Dario Picca
Save Key and Value in JSONformat using C# and LINQ
by Tragdor
A quick lesson in LINQ and dynamic Lambda statements
by Dev Leader
This article is follow up content to previous articles I've written about iterators and collections, but the benchmark results were NOT what I expected!
by Kenji Elzerman
Let's take a look at the very fundamentals of LINQ and how to use it.

All Articles

Sort by Score

LINQ 

29 Mar 2010 by Nish Nishant
An ExifReader class in C# that supports custom formatting and extraction. StyleCop compliant code, with demos for WPF and Windows Forms.
15 Sep 2014 by Daniel Vaughan
Create best-in-breed cross-platform MVVM apps using Calcium for Xamarin.Forms.
30 Apr 2009 by Roman Kiss
This article describes a design, implementation and tooling of model driven WorkflowServices logically centralized in the Repository and physically decentralized for their runtime projecting.
27 Nov 2009 by Max Paulousky
This article presents the techniques and caveats of building Silverlight applications that can be notified about database state changes via polling duplex. WSHttp binding and CLR triggers are used to implement the solution as well.
9 Apr 2021 by Ilia Reznik, Vladimir Shatalov
How to classify articles on Wikipedia using XML dump
3 Sep 2008 by Ahmed Negm
This article introduces how to create and manage .NET enterprise applications using your favorite technology (Data Access Application Block, LINQ, NHibernate, ASMX, and WCF) with the Model Driven Development approach by Sculpture.
30 Oct 2022 by Nick Polyak
Explains concepts of Expression programming by simple examples
10 Oct 2012 by Andrew Rissing
An intuitive-fluent API for generating Linq Expressions.
21 May 2012 by Zimin Max Yang
Dynamic table mapping for LINQ-to-SQL, suitable for data horizontal partitioning (Shard).
8 May 2007 by Ming.Chen
A LINQ Implementation for Google Images/Groups Search
11 Oct 2011 by Enrique Albert
Baseline WCF Distribution Layer - Decoupling of WCF Services and ViewModels.
8 Jan 2018 by thangchung
This article will show you how to expose the database schema to the APIs, then query from it. No boilerplate code for simple query actions. Go and read it.
7 Apr 2017 by Marco-Hans Van Der Willik
This article continues with the development of the SOLID Poker project, and covers functionality to Compare and Validate Poker Hands.
17 Aug 2009 by vic_ch2000
A nullable datetime column in .NET DataGrid with DateTimePicker.
25 Feb 2010 by dasblinkenlight
Converting between types in .NET
21 Jan 2013 by Srinivasu Pemma
This tip provides an easy way of dealing with different types of data sources for LINQ Group By taken from my blog http://www.srinetinfo.com/2012/12/linq-group-by.html
28 Feb 2016 by WuffProjects
WuffProject.CodeGeneration is an easy to use, reliable and powerful code generation framework
6 Jan 2019 by Mehedi Shams
Crossword creator - with a touch of Unicode Logic!
7 Sep 2009 by Tamer Oz
PocketPcAgent is an application that can be installed on Windows Mobile devices that are running Windows Mobile 5.0 or higher. The application listens to events such as SMS Received, Call Missed, E-Mail Received, Battery Strength Changed, and much more on the Pocket PC.
10 Aug 2012 by Wonde Tadesse
The following procedures will help you to provide the service.1. Prepare a good documentation for the configurable parts of the wcf service. These configuration parts could be the endpoint, identity etc.2. Use SvcConfigEditor.exe[^] which is provided by Microsoft for such purpose.Note:I...
18 May 2017 by Yuriy Magurdumov
Lazy Joining and Grouping IEnumerable extensions for ordered sequences
6 Oct 2008 by Modesty Zhang
Port Cairngorm 2.2.1 to Silverlight 2 Beta 2. Includes all source code and a sample application.
17 Jul 2009 by eyedia
Sequential workflow as a WCF service. Create workflow custom activities, invoke child workflow from parent. Configure workflow runtime service using a config file. Basic idea of rules, creating a rule using the rule editor. Applying rules during runtime.
9 Oct 2010 by Stefan Savev 2
Describes how to dump information from the C# parse tree
12 May 2017 by DaveDavidson
In this article, I show LINQ to Entities syntax that will produce queries with CROSS APPLY and LEFT OUTER JOIN clauses.
20 Apr 2018 by Eric Lynch
Part 3 in the LINQ series, this provides an introduction to IQueryable, IQueryProvider, and LINQ expression trees.
11 Jan 2020 by Mehdi Gholam
Using list of objects, LINQ and SQL like string query instead of a database with fastJSON serializer
24 Jan 2008 by defwebserver
This tutorial will show you how to create a DotNetNuke module using LINQ to SQL.
19 Jan 2012 by stuxstu
Job application tracker for those out of work built using Visual Studio Lightswitch 2011.
18 Sep 2013 by Muraad Nofal
A haskell monad/(applicative)functor like interface in C# that extends IEnumerable.
17 Sep 2014 by Daniel Vaughan
Create a Xamarin Forms tabbed page or carousel page by binding to a collection of ViewModels; extending beyond the current capabilities of Xamarin Forms.
7 Sep 2018 by Robert Vandenberg Huang
Experiment, run and compare different pathfinding algorithms and heuristic functions
12 Jul 2009 by Eric J. Smith, Shannon Davidson
Easily detach entities when using LINQ to SQL
14 Jun 2016 by Akhil Mittal
This article will cover other debugging improvements of VisualStudio 2015 like the tool window support for LINQ and Lambda expressions, the newperftips, and the new diagnostic tool window.
29 May 2017 by tranthanhtu.vn
In this article, We will learn why do we need to manage the stages of our application.
2 Feb 2013 by Marc Clifton
A prototype application for cross-referencing and indexing files, URL's.
7 Oct 2014 by Milad Ashrafi
We need this script for database based ASP.NET websites for using HTML content in post pages.
14 Nov 2013 by shijo joseph
An extension methods library which could do the equality comparison operations easily
3 Sep 2014 by debashishPaul
How to convert LINQ query to DataTable
29 Sep 2016 by matt warren
How to optimize Linq
9 Mar 2022 by Coding Notes
An introduction to ASP.NET Core MVC
13 Aug 2009 by webdev_hb
jLinq is a Javascript query language that makes it easy to work with large arrays of information. Today, jLinq 2.2.0 is released which offers new commands, bug fixes and more!
26 Oct 2010 by Matt T Heffron
Since SortedSet has a constructor that takes an IEnumerable parameter, the ToSortedSet extension method can be greatly simplified:public static SortedSet ToSortedSet(this IEnumerable t){ return new SortedSet(t);}
18 Jun 2015 by Duke Of Haren
Playing around with LINQ for JavaScript
6 May 2012 by CodingBruce
How to use a Linq2Xsd generated object to directly manipulate XmlSchema
8 Apr 2011 by Henry Minute
Or, there's always Scott Guthrie's LINQ To SQL Debug Visualizer[^].[Edit]While I'm posting links there is a nice utility that can output the generated SQL to the Debug Window in VS written by Kris Vandermotten.You can get it here[^].To use it: MyDataContext db = new...
11 Apr 2011 by jim lahey
Using your code, I'd do it like this:var results = records.Where(r => Keys.Contains(r.key));
25 Jan 2012 by Sion Cohen
An elegant programmatic solution for having multiple indexers in C#
8 May 2012 by VJ Reddy
From the question it appears that all rows from datatable, which do not contain JOB in stauscode column are required to be filtered out, as the same datatable is used in the inner query. If that is the case, then I think the following query can be used.var filteredRows = from n in...
18 Jul 2013 by Mannava Siva Aditya
Uploading multiple files and creating a Zip file in ASP.NET with C#.
31 Jul 2013 by Hisham Abdullah Bin Ateya
Querying a family tree in LINQ fashion.
19 Aug 2013 by morzel
How to match text which is preceded by some other text? How to reference matched text to find closing tag? Read this post if you want to know the answers to these and few other questions.
31 Oct 2013 by Debopam Pal
How to bring data from Entity model to Excel file using LINQ.
14 Apr 2014 by Maninder Singh Puhi
Appropriate query to fetch required no of results from DB instead of getting all at on time for binding controls like Gridview, listview etc
28 Sep 2014 by Vahid_N
It's easy to forget not disposing object contexts, which leads to memory leaks and also leaves too many related connection objects not disposed as well.
3 Sep 2015 by OriginalGriff
First of, never fetch DateTime.Now more than once: it leads to intermittent problem around midnight which can really mess you up. Fetch it once, and use it for all checks.Then try:DateTime now = DateTime.Now;var receiveDetails = objDB.GetAllReceivedDetails().Where(a =>...
17 Jun 2009 by Sacha Barber
How to write custom LINQ extension methods
5 Aug 2009 by Pete O'Hanlon
You can't cast it as such because a.Except(b) returns the type System.Linq.Enumerable.ExceptIterator. You have two options here:c.AddRange(a.Except(b)); or c = a.Except(b).ToList(); "WPF has many lovers. It's a veritable porn star!" - Josh...
19 Jan 2011 by Pranay Rana
Linq Joins with SelectMany
27 Apr 2012 by Tony Dubey
This code demonstrate pros and cons of PLINQ as compared to LINQ
31 May 2012 by Shahin Khorshidnia
HelloUse CommittableTransaction in System.Transactions. Maybe you need to add reference.For example:using (System.Transactions.CommittableTransaction transaction = new System.Transactions.CommittableTransaction()){ //... if(new...
13 Jun 2012 by Prasad_Kulkarni
Please refer:LINQ TO ENTITIES – JOIN QUERIES[^]Inner, Outer, All Join With LINQ[^]
26 Jun 2012 by Wonde Tadesse
Have a look these articles.1.Distributed transactions and TransactionScope [how to get it?][^]2.Entity Framework & Transactions[^]3.TransactionScope and DataAdapters[^]4.Handling transactions in .Net using TransactionScope[^]
30 Apr 2014 by Thomas Daniels
You try to convert a collection of anonymous types to a List with elements of the type ren. Change select new { into select new ren() {List renewedorderlist = (from ordernum in salesContext.SL_OrderIdMapper where ordernum.OrderNumber==placeOrderModel.OrderInfo.OrderID from...
29 May 2014 by Randy Kroeger
Created a POC that dynamically builds a predicate using Expression and Reflection.
27 Jan 2015 by luckylaxman
Create, read, update, delete,Log in and Log out, (CRUD) operations are easy to perform in ASP.NET MVC. By using the default T4 scaffolding templates and strongly-typed views you can quickly build a web application that can create, update, and delete records.
29 Nov 2015 by Michael Bogaerts
What brings the 15.2 release for XAF (win) developers
31 May 2016 by Karthik_Mahalingam
try thisDataTable dt1 = new DataTable(); dt1.Columns.Add("ID"); dt1.Columns.Add("Name"); dt1.Rows.Add(101, "ABC"); dt1.Rows.Add(102, "XYZ"); dt1.Rows.Add(103, "MNO"); dt1.Rows.Add(104, "PQR"); DataTable dt2 = new DataTable(); ...
10 Feb 2018 by Changming Wang
A complete event calendar, using trucking/shipping as an example, built with Visual Studio Community 2015, C# MVC and jQuery.Fullcalendar
1 Jul 2018 by Bahrudin Hrnjica
How to calculate some of the basic statistics operations on data set
16 Aug 2019 by F-ES Sitecore
Select is an extension method with the first param (IEnumerable source) marked as "this"; IEnumerable Select(this IEnumerable source, Func selector) The way extension methods word is the object you enact them on is passed to the "this"...
1 Oct 2019 by MadMyche
First things first; it is always helpful to post code that has some formatting to it, which makes it a lot easier for people to read what you are trying to doSELECT distinct RTRIM(Students.StudentNumber) , RTRIM(Students.StudentSurname) , RTRIM(Students.StudentFirstNames)...
22 Apr 2012 by Overboard Software
QueryMap allows you to pre-translate a LINQ expression into a form that the underlying query provider (such as LINQ to SQL) can understand.
6 Sep 2009 by Eslam Afifi
.Skip(m).Take(n)
5 Oct 2009 by Alexander Yegorov
Practical use of LINQ to XML technology.
5 Oct 2009 by Alexander Yegorov
A practical use of the LINQ to XML technology.
13 Apr 2010 by Paulo Morgado
LINQ: Single vs. First
21 Apr 2010 by Mr Orange
Introduction...
17 May 2010 by Rama Krishna Vavilala
I will just make it a little more compact by omitting the Contains method:public static string GetValue(this XElement root, string name, string defaultValue) { return (string)root.Elements(name).FirstOrDefault() ?? defaultValue; }The explicit operators for XElement...
15 Jul 2016 by larry118
I am writing an application in VS2010, Framework 4.0, C# and silverlight 4.I have a simple class and Linq Query.The class is:public class pmDues { [Key] public int DuesID { get; set; } [DataMember] public string dues_type { get; set; } ...
11 Aug 2010 by Paulo Morgado
Dumping Objects using Expression Trees
7 Feb 2011 by Nish Nishant
Typically this is done with a call to Cast(). I don't know the VB syntax to call it, so check this page out:http://msdn.microsoft.com/en-us/library/bb341406.aspx[^]
15 Feb 2011 by Fredrik Bornander
You're running into problems because you're trying to read elements in a namespace without specifying that namespace.The last attribute of the XML, xmlns="http://www.dealerlink.us" defines the default namespace of the document as http://www.dealerlink.us.You can fix that by prefixing...
7 Nov 2011 by Sergey Alexandrovich Kryukov
This is what it is: you cannot use nullable types. You did not provide declaration of the type of p but by some its members in your code I can guess their declarations are like this:int? Year;int? TermNo;//maybe uint? ulong? or something like thisOtherwise comparison with null I...
7 Dec 2011 by Ganesan Senthilvel
Since .NET 4.0 is the latest framework, you should appear for 70-515 web based development in .NET 4.0
19 Dec 2011 by Wendelius
You can use grouping for that. See: http://msdn.microsoft.com/en-us/library/bb896250.aspx[^]For example: var dataSource = (from t in context.Tags group t by t.Description into t_group select new { Name =...
2 Jan 2012 by OriginalGriff
I'm sorry to tell you, but we can't help.The problem is that there are so many things that could be slowing down your software, that to give you any concrete results, we would have to give you such a massive list of generalities that you would have to wade through it for hours looking for...
2 Jan 2012 by Espen Harlinn
As you have DevExpress, why not use Xpo[^]?You should also take a look at DXGrid: Server Mode[^]The DXGrid supports a binding mode designed to work with large datasets. This is called server mode. With this mode, even if the grid control is connected to a data store containing millions...
3 Jan 2012 by Wendelius
You should be able to simply define an alias without any extra characters as long as the names of the aliases conform to C# naming rules. For example, try the following:var q = from a in Number join b in Dupnum on a.ID equals b.ID select new ...
4 Jan 2012 by Shahin Khorshidnia
Ok, for example you have a collection of person :List PersonList = new List(); Person person1 = new Person() { Name = "John" }; Person person2 = new Person() { Name =...
4 Jan 2012 by fjdiewornncalwe
Shahin's answer will help your performance issue as his method will quite simply be more efficient.However, you may have a bigger root issue. If your list of persons is being loaded from the database, then I would suggest that your paging be done on the db query side. Your performance issue is...
7 Mar 2012 by Sunil_Sebastian
Duplicate Notifier for a List using ObservableCollection.
25 Apr 2012 by VJ Reddy
The following LINQ query can be used to obtain the above resultsvoid Main(){ DataTable accData = new DataTable(); accData.Columns.Add("Date",typeof(DateTime),null); accData.Columns.Add("Credit",typeof(double),null); accData.Columns.Add("Debit",typeof(double),null); ...
17 May 2012 by VJ Reddy
Introduce a where clause to remove the empty strings as followsvar Serialnumberentered = from a in serialNumbercheck//For .NET 2.0 and 3.5 where a == null ? false : a.Trim() != string.Empty //or where (a ?? "").Trim()!= string.Empty ...
31 May 2012 by VJ Reddy
The above data can be converted into a heirarchial data source with XML data using LINQ with GroupBy extension method, and then it can be bound to the TreeView as shown below:protected void Page_Load(object sender, EventArgs e){ DataTable dt1 = new DataTable("DataTable1"); ...
7 Jun 2012 by Matt T Heffron
This is an alternative for "Word wrap without cutting words"
13 Jun 2012 by Vani Kulkarni
Hello, Please go through the link given below:http://stackoverflow.com/questions/37324/what-is-the-syntax-for-an-inner-join-in-linq-to-sql[^]http://msdn.microsoft.com/en-us/library/bb397941.aspx[^]
13 Jun 2012 by AmitKumar89
Hi,Please refer the links:http://stackoverflow.com/questions/525194/linq-inner-join-vs-left-join[^]http://msdn.microsoft.com/en-us/library/bb397941.aspx[^]http://msdn.microsoft.com/en-us/library/bb397676.aspx[^]All the best.--AK
18 Sep 2012 by Sergey Alexandrovich Kryukov
Please see my comment to the question. Your question might be based on some your misconception or maybe the conception you do not explain.The relationships should not really be quantified by the total number of them or something like that. And "a lot of relations" does not have to mean "a...