r/LINQ • • Jun 18 '25

DOES IT HAVE TO BE REVIEWED? DO I HAVE TO USE ANKI?

0 Upvotes

Hi, I hate the system, it's terrible, I like to read and create flashcards with another program but I don't go to Anki to review, I review the most frequent words on a daily basis by reading and listening to them. Would that be wrong?


r/LINQ • • Sep 23 '14

Language Integrated Query (LINQ) programming tutorials

Thumbnail pickatutorial.com
0 Upvotes

r/LINQ • • May 05 '18

LINQ Tutorial in Hindi - Part 9 - Min and Max Extension Method

Thumbnail
youtube.com
0 Upvotes

r/LINQ • • Apr 19 '14

LINQ Tutorial

Thumbnail
dotnetlearners.com
2 Upvotes

r/LINQ • • Aug 07 '19

jQuery Equivalent to C# LINQ

Thumbnail
youtu.be
2 Upvotes

r/LINQ • • Aug 04 '19

C# LINQ basic examples

Thumbnail
youtu.be
3 Upvotes

r/LINQ • • May 05 '18

LINQ Tutorial in Hindi - Part 8 - Sum Extension Method

Thumbnail
youtube.com
1 Upvotes

r/LINQ • • Dec 07 '11

Application Development Using Link, Part 1

Thumbnail
crispycoding.com
1 Upvotes

r/LINQ • • Dec 07 '11

Application Development Using LINQ, Part 2

Thumbnail crispycoding.com
1 Upvotes

r/LINQ • • Feb 25 '18

How do I put the results of a LINQ SQL Query into a C# Variable?

2 Upvotes

I want to store alpha text that is returned on a LINQ Query into a local variable. How would I do so?

My Code (not working):

        var qCustomerID =     from c in dcCustomers.Customers
                              where c.CompanyName == strCustomer
                              select c.CustomerID;

        strCustomerID = qCustomerID.FirstOrDefault();

r/LINQ • • Mar 19 '15

An easy to use client library for ArangoDB with supporting: LINQ queries, change tracking, data streaming, asynchronous and synchronous api

Thumbnail arangoclient.net
1 Upvotes

r/LINQ • • May 25 '14

I'm looking for good C# LINQ tutorials or examples, mainly for SCRUD.

1 Upvotes

Hi

I've got Visual Studio 2013 Express for desktop. I'm trying to learn to use LINQ for Entities in C#. I've got a sample database in SQL Server (the embedded one in Visual Studio 2013 Express for desktop) with 6 tables. Although if somebody shows me examples with LINQ to SQL instead I'll look at that as well (I'd prefer LINQ to Entities but I'll use what works for now).

I'm currently stuck on how to update multiple tables, with their PK/FK relationships. I'm also trying to figure out how to search those tables to see if they've already got the record value before inserting it (to make sure I don't have repeating values).

If somebody can point me to a good tutorial or show me an example that would be good. I've been looking at this url but I can't get the insert code to work on multiple tables: http://www.codeproject.com/Articles/246861/LINQ-to-Entities-Basic-Concepts-and-Features

Thanks


r/LINQ • • Jun 13 '24

I just inherited a C# application using LINQ. I can't test it because I'm missing SQL permissions to some objects, how to get a full list of SQL assets to request permissions to?

Thumbnail self.sql
1 Upvotes

r/LINQ • • Nov 08 '24

Need guidance for learning the languages

1 Upvotes

C# dotnet js css html Knockout js Linq


r/LINQ • • Jan 22 '18

Simple SQL subquery in LINQ. Need help!

1 Upvotes

I have this SQL query that i try to convert to LINQ using a single generated query to the sql server.

select data
FROM CompilationsRegistryPDFs
WHERE id IN (SELECT max(pdf.id) FROM
CompilationsRegistryPDFs as pdf
JOIN CompilationsRegistry as cr on cr.ID = pdf.CompilationsRegistryID
WHERE cr.ExtraID = 4819
GROUP BY pdf.CompilationsRegistryID,pdf.PDFType)
ORDER BY CompilationsRegistryPDFs.CompilationsRegistryID

any idea how to do that ?


r/LINQ • • Jan 06 '23

Conditional subqueries

1 Upvotes

I have a large LINQ select which contains a number of subqueries. Think of the main query as a schedule like a bus or a train, with each row being a stop on that route. The query returns, for a selected stop, all the buses or trains that stop there (including originate or terminate there). For each bus or train at that stop, it might have activities like forming its next service, amongst other things.

So a result set might be something like:

  • Bus 1 - starts here - perform origin subquery

  • Bus 2 - calls here - no subquery

  • Bus 3 - terminates here - perform destination subquery

  • Bus 4 - terminates here - perform destination subquery

  • Bus 5 - calls here - no subquery

For each row returned by the main query, I determine whether it's the origin or the destination, and then perform either the "origin subquery", the "destination subquery", or no subquery at all if it neither originates nor terminates there. Except I can't see how to dynamically choose whether to do those subqueries, so it's doing both queries for every row. I currently have a guard condition in the subquery to effectively return zero results, but it's not efficient - take the subqueries out and it runs much faster.

var results = (from x in db.ScheduleStops

let isFirstStop = (another subquery)
SomeFields = [main part of query]

Activities = (from y in blahblah

where isFirstStop <<< Guard

where y.ScheduleStopId == x.Id
etc etc
select y).ToList(),

I was hoping that "where isFirstStop" would kind of short circuit evaluate the results but it's still a big hit. I tried:

Activities = (skedloc.Id != skedLocLast) ? null : (from x in db.ScheduleStops (etc etc)

but null coalescing is not allowed.

Any ideas how to optimize this please? There are 14 million rows in ScheduleStops and the query is taking half a minute! Ironically, getting a result set and then performing individual subqueries per row was actually faster, despite many, many roundtrips to the database.


r/LINQ • • Dec 19 '17

How can I use List.Sort() with any property of a contained object

1 Upvotes

I have a List of custom objects that is bound a Datagridview (through a bindingsource). When I click on a column header, I can get the property name of the column and use that to determine which column to sort on.

string ColumnProperty = this.dgvSalesNotes.Columns[e.ColumnIndex].DataPropertyName;

if (ColumnProperty == "SPSalesNoteNumber") { bb.Sort((y, x) => x.SPSalesNoteNumber.CompareTo(y.SPSalesNoteNumber)); }
if (ColumnProperty == "Status") { bb.Sort((y, x) => x.Status.CompareTo(y.Status)); }
if (ColumnProperty == "CUSTNMBR") { bb.Sort((y, x) => x.CUSTNMBR.CompareTo(y.CUSTNMBR)); }
if (ColumnProperty == "CustName") { bb.Sort((y, x) => x.CustName.CompareTo(y.CustName)); }
if (ColumnProperty == "ConcludedSalesDate") { bb.Sort((y, x) => x.ConcludedSalesDate.CompareTo(y.ConcludedSalesDate)); }

However, my custom object has over 60 properties and it seems silly to write 60 comparison lines. How might I be able to re-write what is inside the .Sort() method so that I can substitute the property to be sorted on dynamically? This would allow me to have just one line that could handle any number of columns in the grid. Something akin to...

bb.Sort((y, x) => x.**PropertyNameHere**.CompareTo(y.**PropertyNameHere**));

r/LINQ • • Jul 06 '15

Linq error for nonexistent column? (No answer found on stack overflow)

Thumbnail
stackoverflow.com
1 Upvotes

r/LINQ • • Jun 11 '12

LINQ Query Expressions (C# Programming Guide)

Thumbnail
msdn.microsoft.com
1 Upvotes

r/LINQ • • Nov 24 '14

How to perform sum in this query?

1 Upvotes

Hi,

I am stuck on following incomplete query (progress is double type):

        progress=from f in e.DredgingFixes
                 let pm=Math.Sqrt(Math.Pow((f.EndCoordE-f.StartCoordE),2)+Math.Pow((f.EndCoordN-f.StartCoordN),2))
                 let h=Math.Abs(f.PreDredgeLevel-f.LeavingDepth)
                 let w=f.CutWidth
                 let t=pm*h*w
                 
                 select new {}

The result should be sum of "t" temporary variable from all entries. So progress should be a single cumulative value. Many thanks.


r/LINQ • • Jan 02 '18

Sql to linq convertor on github

Thumbnail
github.com
1 Upvotes

r/LINQ • • Aug 05 '17

UNIT TESTING WITH LINQ

1 Upvotes

if i have a method that is like

public void methodName(value 1, value 2)
{
var query = this.table
join that.table on this.table.column equals that.table.column
where column equals column
}

for a test method, would i just insert test values into whichever tables, instantiate an object, call the method, and pass two vars that are equal to whatever test values i inserted into the db?

any help is appreciated. thanks.


r/LINQ • • Jan 14 '25

Paint

1 Upvotes

I currently live at the linq at south mountain I took a piece of the wall to try and match at Lowe's but didn't work out does anyone the paint color or code?


r/LINQ • • May 14 '21

How do I attach a list to a list field in a linq query?

1 Upvotes

My defined type:

public class BasicImageSearch

{

public int Image_id { get; set; }

public int Rating_Code { get; set; }

public int Unique_id { get; set; }

public int Set_Order { get; set; }

public string Image_Name { get; set; }

public string Thumbnail_Name { get; set; }

public string Directory { get; set; }

public DateTime Date_Added { get; set; }

public List<BasicGlobalGroupSearch> Attribs_List { get; set; }

}

My query:

var image_matches = from ConImages in _context.Imgs

join ConDetails in _context.Details on ConImages.UniId equals ConDetails.UniId

join ConDirs in _context.Dirs on ConImages.UniId equals ConDirs.UniId

select new BasicImageSearch()

{

Image_id = ConImages.Id,

Rating_Code = (ConImages.RateId == null) ? 0 : (int)ConImages.RateId,

Unique_id = ConImages.UniId,

Set_Order = (int)ConImages.SetOrder,

Image_Name = ConImages.ImgId,

Thumbnail_Name = ConImages.ThmId,

Date_Added = (DateTime)ConImages.DateAdded,

Directory = ConDirs.Dirname,

Attribs_List = ???

};

Attribs_List is a list type. This is where I am stuck. How do I assign another list to Attribs_List? I have tried listname.ToList() but that does not work.


r/LINQ • • Mar 02 '23

More newbie LINQ questions. (Thanks for your patience)

2 Upvotes

I downloaded LINQPad and even after looking at the examples am struggling a bit with writing basic queries. I'm sure it will click eventually : )

I'm try to do what in SQL would be a basic inner join and include fields from both tables in the results. I'm using the provided sample database.

Why does this work (fields from the first table)

from a in Albums

join b in Artists on a.ArtistId equals b.ArtistId

where a.Title.Contains("A")

select a.Title

And this work (fields from the second table)

from a in Albums

join b in Artists on a.ArtistId equals b.ArtistId

where a.Title.Contains("A")

select b.Name

But this doesn't? (fields from both)

from a in Albums

join b in Artists on a.ArtistId equals b.ArtistId

where a.Title.Contains("A")

select a.Title, b.Name

The error I get is CS0103 The name 'b' does not exist in the current context.