0
votes
2answers
56 views
What does “Replace with single call to single” mean?
When using LINQ with Single() I always get my line of code underlined in green with the suggestion "Replace with single call to single." What does this mean? Here's an example of a line of code that ...
-1
votes
2answers
47 views
Getting a comma seperated list from a linq projection
var users = from u in db.Users.Include("UserLogins")
join ul in db.UserLogins on u.UserId equals ul.UserId
join ua in db.UserActions ON ul.UserLoginId = ua.UserLoginId
where ...
2
votes
1answer
50 views
Comparing each element with each other element in a list
What is the best way to write a control structure that will iterate through each 2-element combination in a list?
Example:
{0,1,2}
I want to have a block of code run three times, once on each of ...
0
votes
0answers
51 views
Translating LinQ into standard Java
I am still learning how to translate C# code using LinQ into standard Java. I am currently working on the following.
// For reference
private SortedSet<Message> _set = new ...
1
vote
1answer
28 views
Replace a type in an expression tree
I'm struggling with the modification of an expression tree. I've simplified the example to make it easier to display here. Let's start with two classes:
public class Filter
{
public ...
1
vote
1answer
72 views
How can I speed this LINQ query up?
I know that there's a much more efficient way to do this, using predicates, but being fairly new, I'm not sure exactly how to go about it..
List<HousingAssignment> list;
using (OEContext ...
0
votes
1answer
37 views
ReSharper/Linq error: Access to modified closure
In a validation .cs file on my ASP MVC 3 site, I am trying to run a quick check against the database for the existence of an agent ID number the user has entered in. However, ReSharper is identifying ...
0
votes
1answer
34 views
use linq to query a cell from datatable
I want to write a function "getCount" to return a result of int for different usernames from a datatable, as follows:
static void Main(string[] args)
{
DataTable table = new DataTable();
...
0
votes
2answers
64 views
Trying to output all information with linq
I've written some code that matches two arrays by the identifiers called "seqNum" and gets an answer from some math. I'm able to print out the seqNum and the Answer I get but I'm having trouble ...
1
vote
1answer
34 views
Entity framework calculated field by Expression<Func<T,V>>
I would like to create calculated fields only in .net code, without defining columns in sql.
For example in this classes:
public class Customer
{
public int Id { get; set; }
...
0
votes
2answers
42 views
String was not recognized as a valid DateTime - Whats wrong?
I have been getting an annoying littler error and cannot for the life of me figure out why it is being cause. I have an xml file where i am storing data, as shown below.
- <EmployeeFinance>
...
1
vote
1answer
46 views
Trying to output an answer with linq
I've been working on a program that joins two arrays by an identifier called "SeqID" and outputting an answer to a CSV file.
Whenever I output this answer to a file it prints out the same answer for ...
0
votes
2answers
29 views
The most elegant and efficient way of calculate union of a collection of IEnumerable
I know I can use Linq to produce the union of 2 IEnumerable collections.
It should be something like:
IEnumerable<MyClass> first;
IEnumerable<MyClass> second;
IEnumerable<MyClass> ...
1
vote
2answers
47 views
How can I union two dictionary with the same Key?
Dictionary 1:
Dictionary<string, IList<PuntoMappa>> PuntiCantieriCMS = new Dictionary<string, IList<PuntoMappa>>();
Dictionary 2:
Dictionary<string, ...
1
vote
1answer
13 views
Choose XML transaction based off descendants with LINQ
I want to get a list of transactions based of a descendant. But I am having trouble getting the linq syntax correct.
My data looks like this:
<Data>
<MyTransactionXML>
...