Skip to main content

All Questions

Tagged with
0 votes
1 answer
23 views

How I can select two elements to one list with linq

Firstly I need to create string array that include elements came from different properties of one object. At the below code MyDatas is IEnumerable, prop1 and prop2 are string. var array = myDatas....
EsprnzJK's user avatar
1 vote
1 answer
52 views

Using LINQ to retrieve multiple records that fit criteria

I have a FE that allows a user to filter based on different criteria. One of these criteria is Business Units. When a user selects this filter the URL looks like this: https://localhost:7206/api/v1/...
shizz's user avatar
  • 11
2 votes
1 answer
631 views

Calculate average of floats array using LINQ

Beginner here, I have a list that stores arrays of floats (each array reflects a vector, if it matters): List<float[]> My goal is to calculate the average values of all these arrays (that is, ...
TonySoprano's user avatar
-2 votes
3 answers
562 views

Is there an easy way to flatten an array of objects while making an array of the one column that would be different?

I have an array of objects similar to this: class StateVisitor { string FirstName { get; set; } string LastName { get; set; } string StateViseted { get; set; } } StateVisitor[] ...
Dave Matney's user avatar
0 votes
3 answers
1k views

How can I skip loop for first and last element of array and set them to constant value?

I would like the loop to start from the second element and to end before the last one. So that I can set the first and last one to constant value. for (int i = 0; i < n; i++) { for (int j = 0; j &...
klmtsgw's user avatar
  • 13
1 vote
1 answer
365 views

Cartesian product of an array with itself a variable amount of times?

I want to write a function which returns the cartesian product of an array with itself a variable amount of times. Now, if the number of cartesian products is known at compile time, then I can do the ...
the man's user avatar
  • 1,371
0 votes
0 answers
180 views

How to export Linq List to Excel Range

I have a list converted from Json having approximately 26 fields. Among those fields I need to select a few as below var use = Data.USEData.Where(x => x.GLMBorrowerName == borrowerName) ...
Sonu Kumar's user avatar
0 votes
2 answers
72 views

What's the best way to acquire a list of strings that match a string inside a string, by looking through a string list?

Basically I have a string array that I am using to match inside a single string: string[] matches = { "{A}", "{B}", "{CC}" }; Then I from these I look if I find any of these inside my string: ...
Joan Venge's user avatar
  • 330k
1 vote
1 answer
44 views

Looking for an element in a non-Jagged 2D Byte array in C#

I have created a 2D Byte Array with 3 rows and columns (order 3*3 Matrix) and it's not a Jagged Array. var arr = new byte[3,3]; But now I have to know if a specific element exists in the array or ...
Anirudh Kanaparthy's user avatar
0 votes
2 answers
366 views

Spliting string in LINQ and using 2nd Index value

I am stuck to split an Email to get the Domain of Email in group by clause of LINQ to group the data by domain. My LINQ is ( from u in DbContext.UserProfiles join ap in DbContext.AspNetUsers ...
Fahad's user avatar
  • 37
3 votes
3 answers
396 views

Why does IEnumerable's Where pass first argument as "this"

I've just started to study on LINQ. The following example uses Where which is one of the standard query operators. string[] names = { "Tom", "Dick", "Harry" }; IEnumerable<string> filteredNames ...
Soner from The Ottoman Empire's user avatar
1 vote
1 answer
205 views

Getting a two dimensional array of all possible unique combination of numbers lower than a mixmum for each cell starting from 1

Hello and thanks for your attention. (my mathematical vocabulary for English language is rather limited, if you can think of a better title for this question please feel free to edit and thanks for ...
Soorena Aban's user avatar
-3 votes
1 answer
2k views

How to add/append some objects into an object array [duplicate]

How to add/append some objects into an object array with C#, I can add a static object but I don't know how to add an object with dynamic. please do me a favor to give me any slight clue to deal with ...
Willie Cheng's user avatar
  • 8,203
0 votes
1 answer
375 views

Selecting Distinct Items within Array using PowerShell and Linq

I have been banging my head on this problem for a few hours. I have a multi-dimensional array and I need to select the unique items based on two "columns". Is there an efficient .Net or otherwise ...
BDubs's user avatar
  • 73
0 votes
2 answers
677 views

Remove rows where column contains specific text

I want to remove all the rows of the data whose columns contains ? e.g. in around 100 rows for Column Status I am getting value as Unknown?, Error?, InProgress, Done So , I want to remove all the ...
Rahul Sharma's user avatar

15 30 50 per page
1
2 3 4 5
8