Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
2answers
87 views

Inserting and updating record using LINQ by calling a common function

I have a function named InserUpdateRecords(int flag) to which I pass integer variable which indicates the type of operation it has to perform , if flag==1 then insert , if flag==2 then update. Here is ...
1
vote
1answer
91 views

Load assemblies with injector module

How can I improve the performance of this method or is it already good? private static void LoadAssembliesWithInjectorModule(IEnumerable<FileInfo> files) { var moduleType = typeof ...
0
votes
0answers
77 views

converted recursive code to LINQ [closed]

I ended up figuring how to convert I think its faster I dunno. private void findGoogleOrganic(HtmlNode node) { if (node.Attributes["class"] != null) { if ...
1
vote
1answer
46 views

LINQ style Sample method

I Needed a method to randomly sample an IEnumerable collection without replacement. I'm using this for writing behavioral acceptance tests. For example, in the test code, I write: ...
1
vote
1answer
49 views

How could I remove repetition from this linq-to-entities query?

This linq query works, and it does what I want it to do, but is there any other way I could improve the query so I'm not repeating a.AnswerRevisions.OrderByDescending(r => ...
4
votes
3answers
129 views

Code Review for generic cached IEnumerable<T>

I've an IEnumerable source which takes time to generate each item. Once an item is generated I want to cache it to avoid recomputing same. I want to separate out caching logic from original source. ...
2
votes
3answers
116 views

Setting Output parameter inside LINQ select

Here is my code , is there a way to reducing number of lines by setting output variable inside LINQ select statement? How would you be doing it? public void GetSomeValue(int bonusID, out decimal? ...
5
votes
1answer
142 views

LINQ Compare Query Improvements?

I'm attempting to create a compare table to compare products depending on the add-ons they have. To grab the data and filter it I'm using LINQ To SQL. Table's Layout (Cut short): Products Table ID ...
1
vote
1answer
90 views

Merging IEnumerable and removing duplicates

I have a method that exacts data from an XML and returns an IEnumerable<Foo>. I am trying to create a method that will merge the results from 2 different XML's files into a single IEnumerable ...
2
votes
2answers
82 views

Better way to do this LINQ statement?

I'm still really new to LINQ and I ask this question because of my lack of knowledge about the framework. Is there a more readable and/or efficient way to write the following LINQ code? (FYI, I'm ...
2
votes
1answer
83 views

Clever way to build a extension method that ordenate my IQueryable<T>?

I want to create a ExtensionMethod to ordenate my linq query, called Ordenar. I'll sort it depending what columns is in sortColumns ListDictionary. I tried some ways, but the best way I arquieve was ...
2
votes
1answer
70 views

Converting NameValue pair entity to XML

I have the following code, to store a web service name value pair response into DB. I am saving it in xml column of DB. Kindly highlight the issues with this approach. Please note that the name value ...
2
votes
3answers
65 views

Using `from select`-syntax to pass through elements from a collection unmodified

While working on a project with a friend of mine, I noticed the following syntax: public IObservable<X> GetXs() { return from x in xs select x; } He said that while xs is an ...
0
votes
1answer
58 views

Help me improve my attempt to slap strong types on top of COM and ODBC

I am stuck with some old API that involves COM and ODBC, and I cannot switch to cool things like MEF or entity framework. So, I am working on some wrappers that will help me write less code and also ...
1
vote
1answer
139 views

For in for optimization

I'm trying to optimize this code: foreach (string id in ids) { MyClass x = myDictionary[id]; foreach (var map in Maps) { if ( x.id == map.SourceId || x.id == map.DestionationId) { ...

1 2 3 4 5
15 30 50 per page