Skip to main content

Questions tagged [linq]

Language Integrated Query (LINQ) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages. Please consider using more detailed tags when appropriate, for example [linq-to-sql], [linq-to-entities] / [entity-framework], or [plinq]

linq
0 votes
3 answers
58 views

how to filter IQueryable from a list

So I have a model 'X' with a property of another model 'y' set on it and 'y' has an 'id' property. I first define: IQueryable<X> tempObject; and initially populate with: tempObject = (from b in ...
bilpor's user avatar
  • 3,771
1 vote
1 answer
94 views

C# cannot use .Any() when build Expression for querying with EF core

I'm trying to build an Expression<Func<T, bool>>: public static Expression<Func<T, bool>> CreateAny<T, TAnother>( Expression<Func<T, IEnumerable<TAnother&...
Dat Truong's user avatar
0 votes
1 answer
50 views

How to test a method that calls a persistence method returning IQueryable

I read in a few places that it's a good practice for a method that calls the database to return IQueryable because it allows extending queries in services using methods like Select, Where, etc., and ...
capslo's user avatar
  • 45
0 votes
0 answers
65 views

How to filter only numeric part in of the query in linq

I have the following code in linq where I am trying to filter the numeric part from the column with the passed in number public async Task<IEnumerable<Transaction_DTO>> ...
Developer's user avatar
  • 8,552
0 votes
2 answers
60 views

linq join two datatables

I am trying to join two datatables with linq The query is out_dt = (From row1 in dt1, row2 in dt2 where row1("id").ToString = row2("id").ToString Select row1).CopyToDatatable ...
user13831679's user avatar
-2 votes
1 answer
55 views

How to filter a table using linq?

I have data table like below Metal value silver 5 silver_ref Y gold 2 gold_ref N iron N iron_ref N From this data table I want to filter like below way if silver,gold,iron != 'N' and ...
Biswa's user avatar
  • 19
0 votes
1 answer
32 views

Include in and condition only if property is not null

I am having lambda expression where I am getting record when all the values are equal in input object and db object var matchingrecord = (from data in dbContext.TableA where ...
AMDI's user avatar
  • 963
0 votes
1 answer
40 views

C# return a single aggregated value using LINQ

I'm want to acquire a total from an IEnumerable collection class using LINQ. A condensed version of my collection class is: public class BrokerCcyValue { public string BrokerCode; ...
Mark Roworth's user avatar
0 votes
1 answer
91 views

Does EF Core load all properties of an entity before loading the entities in .Include?

I have an entity for which I have property that's dependent on a virtual member. While loading the entity, I am getting the virtual member as null even though I have included it in .Include. My entity ...
Tushar Swarup Tandon's user avatar
-1 votes
1 answer
114 views

List used as a queue in .net and retain order [duplicate]

I want to use a List as a queue. This is because List is more flexible when getting/inserting data. My question is when I use Linq operations (DistinctBy, Take) as shown below, do I still get the ...
Patola's user avatar
  • 563
0 votes
0 answers
92 views

HOW to generate SQL TRANSFORM, INNER JOIN and GROUP BY with database MS ACCESS IN VB.NET

I'm trying to generate SQL TRANSFORM, INNER JOIN and GROUP BY with database MS ACCESS in VB.NET. I don't want to use functions in MS Access because I use SQL for VB.NET. Is there any other method? ...
Tam88's user avatar
  • 71
1 vote
1 answer
77 views

How to include property of table per hierarchy in EF Core eager loading

Consider the following model classes: public abstract class A { public enum T { B_, C_, D_ } public int Id { get; set; } public int? ParentId { get; set; } public A? Parent { get; set;...
dude's user avatar
  • 15
0 votes
0 answers
36 views

For Loop through filtered datatable using LINQ Select Clause?

Is it possible to loop through a filtered data table and update the items as needed? In my 'For i As..Next' loop, I want to check the value of a specific column in the next row and if they're not ...
Candace Aisenbrey's user avatar
-1 votes
1 answer
64 views

Linq query in c#, Find the previous date

I have a list of stored values where one of their attributes is a date. I am trying to use a Linq query in C# to find the most recent date with respect to my targetDate. So for instance, let's say the ...
LKay's user avatar
  • 1
0 votes
0 answers
154 views

Find the coordinates of the image of the sample in the large image in the shortest time

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim intMain() As Integer = GetRgbValues(picMain.Image) Dim intTemp() As Integer = GetRgbValues(picTemp....
Mansour Dalir's user avatar

15 30 50 per page
1
3 4
5
6 7
5780