Tagged Questions
1
vote
1answer
58 views
How can I make this code better
I hate having almost two identical blocks do almost the exact same thing.
I am working with Entity Framework 4.4.0.0
Asp.Net MVC
Right now if the user is a "manager" I want to show them the entire ...
1
vote
1answer
43 views
Optimize Implementation - Wait for all threads using LINQ
In my program I read several information's about the system. I read each categories like CPU, memory, services, software and so on with a own thread. The main program have to wait for the longest ...
3
votes
3answers
183 views
Linq query performance improvements
As I am getting my Linq query to a functional point, I start looking at the query and think about all the "ANY" , and wonder if those should be a different method and then I have data conversions ...
5
votes
2answers
114 views
Improvement requested for: Generic Calculator and Generic Number
.NET does not support generic numbers. It is not possible to enforce a generic method with generic argument T that T is a number. The following code will simply not compile:
public T ...
2
votes
3answers
127 views
Using Linq to select the first and last values
I want to get just the first and last values in a date range. I have the following code:
using (var myEntities = new dataEntities())
{
var myValues = (from values in myEntities.PointValues
...
2
votes
1answer
42 views
XML to Windows.Forms.Keys List
It took me a lot of poking around and unit testing to get the code to look like it is right now. So I have a XML file which in part looks like this
<FunctionKeys>
...
4
votes
3answers
161 views
LINQ Group query - simplifying
Is there a way of writing this correctly working query more efficiently? I'm asking only to learn LINQ better:
var cpuInfo = edgeLPs
.GroupBy(k => k.CPU.ID, e => e.CPU)
...
2
votes
1answer
122 views
Is there a more elegant way to rewrite this piece of code?
This is what happens, i have a dropdownbox "ActiviteitAardItems" where ActiviteitAard items can be checked (checkbox). If one (or more) are checked the property Opacity will be changed, and the code ...
3
votes
1answer
82 views
LINQ statement to aggregate data
Teachers can raise 'dramas' which are when students forget equipment, don't do homework or are flagged for concern. Each drama for each student is stored as a separate record.
I seek a list of all ...
6
votes
2answers
135 views
Left hand search in string
the requirement for our search query is to look for all search words in the beginning of vehicle manufacturer, model and variant name. Case insensitive. The word being a string of characters separated ...
0
votes
1answer
81 views
making this linq query faster
I need the most efficient way to get the value of the searchName, or if null return searchName. I am returning just a single string, so maybe I should search itemRepository.Item instead of Items
...
3
votes
2answers
101 views
Refactoring from .. in .. select to more compact one
Is it possible to write the two following lines of code in a more compact one?
IEnumerable<int> collection = from partnerNumbers in contract.Contact.PartnerNumbers select partnerNumbers.Pnr;
...
3
votes
3answers
248 views
Rewrite from .. where .. select to more compact one
This is the code:
public DateTime GibSomeStartDate(IEnumerable<int> partnerNumbers, DateTime startTime)
{
return (from contract in this.databaseContext.Contract
where ...
3
votes
4answers
118 views
Finding unconnected sets
I have a list of boxes, and wish to group them into unconnected sets of overlapping boxes. (Note that two boxes A and B may not overlap each other, but if they are both overlapped by a box C, they ...
0
votes
3answers
115 views
New to LINQ, not sure this is best practice
So i have a super class that has a 3 child classes. Those 3 child classes have multiple classes of their own. I was having troubles saving this into XML, so I decided to parse it out and do a little ...