1
vote
1answer
36 views

Making a property virtual to cause EF to load the property?

I am walking through a sample MVC4 ASP.Net tutorial available on PluralSight.com, by Scott Allen. I am in a section #5, Working with Data (part 2), "Listing Reviews". This application has a database ...
1
vote
4answers
143 views

Improving performance hacker rank Median

im trying to compete on hackersrank and my awnswer got accepted but the times are not so good, i have a friend who sent the awnser in c# too but somehow made it a lot faster and im wondering what can ...
4
votes
4answers
163 views

Largest Palindrome efficiency

I have written an algorithm to find the largest palindrome under a given number, but I am sure my code loses efficiency by creating new arrays in every pass. I am currently learning about efficiency ...
0
votes
2answers
90 views

How to take the some elements of a list of random numbers and sort them?

I want to create a file consisting take rows of distinct numbers in ascending order. They are randomly taken from the first total integer. The file will be used to make an excerpt as discussed here. ...
2
votes
1answer
111 views

Optimization expression evaluation chalange

It's my first message on this site. I'm trying to evaluate/learn C#. I'm an old (C++, MFC) programmer. I'm trying to learn C# with this little program(game) for my children. I'm trying to calculate ...
3
votes
1answer
91 views

How to make this BigRational parsing method more efficient?

I'm using the BigRational beta off the BCL CodePlex (bcl.codeplex.com), and I realized it had no parsing method. So I tried to write one. However, it's quite inefficient (5.5ms for a 254 character ...
1
vote
2answers
106 views

How to optimize/refactor this method?

Here is my method: public JsonResult ValidateAll(string toys) { Dictionary<string, object> res = new Dictionary<string, object>(); List<string> result_check = new ...
1
vote
2answers
107 views

Wondering why they created a class instead of adding it to the current class

So for an example, the example site has two class public class LinqValueCalculator { public decimal ValueProducts(IEnumerable<Product> products) { return products.Sum(p => ...
1
vote
1answer
211 views

Improving a Calculator Application

I have here a calculator created using C# that is running on a console. The calculator accepts a string input (e.g. 5+5) then produces the result (5+5=10). It will then prompt the user to enter ...
3
votes
3answers
176 views

Optimization Of Code With Runtime of 150Hours

XPost from Stackoverflow questions as Nicholas Pickering kindly referred me to this. I've been working on a project where I am importing a large document of documents and tokenizing each document. I ...
0
votes
1answer
139 views

How can I implement the generic repository pattern and improve the performance for the code below?

I've used EF-DB first approach and have written a simple app to retrieve the data from the database and show it in the view. The code is simple and ok for a beginner like me, but how can I implement ...
4
votes
1answer
74 views

ObservablePriorityQueue<T> Implementation

I have a requirement in my current project that will need a Prioritised Queue that supports the IObservable interface. Please share any problems with the current implementation below: ...
4
votes
3answers
133 views

Optimize boolean statements

I have the following logic: bool a; bool b; int v = 0; //code here to set the values of a and b... if(b) { v = a ? 1 : 2; } else { v = a ? 0 : 1; } I believe that there may be a way to ...
1
vote
0answers
93 views

Sudoku Valid Arangements Permutations Enumerator

I wondered if anyone has any ideas to make this cleaner or more efficient. Mostly this was an exercise to generate the data once (So speed really isn't too important, but I'd love to see what ...
3
votes
1answer
88 views

Optimization of code for searching in db

This is my code: var test = (from x in myDb.myTable where (x.name == tmp || x.name == tmp2 || x.name == tmp3) && x.unit == u select x).FirstOrDefault(); if (test == ...

1 2 3 4 5 6
15 30 50 per page