C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

learn more… | top users | synonyms

2
votes
2answers
19 views

ArrayList implementation

Can someone help me optimize speed for my code? I tested it via stopwatch in milliseconds. I've implemented my own ArrayList and I would like to improve its speed ...
2
votes
1answer
15 views

MVC API controller processing POST request

Do I need to restructure for readability? ...
1
vote
1answer
18 views

Searching Subdirectories of a Subdirectory for Registry Keys to Delete

Please let me know if I can improve my question in any way I build/maintain an IT Support Self-Help App and recently had the need to include some registry key manipulation when users experience ...
1
vote
1answer
28 views

Closing SQL connection for async operations

The following code executes asynchron on the SQL database. Is the closing of the connection implemented in the right way? Are there any missing features regarding connection handling which need to be ...
1
vote
1answer
48 views

Domain Model for Simple Yes/No

Working from a C# and EntityFramework background. Jimmy Bogard makes the point of modelling your domain model correctly, such ...
-1
votes
0answers
39 views

Expose generic interface method on non generic interface

A little background info for what I'm trying to solve: The purpose of an EntityEventEvaluator would be to generate EntityEvents, which basically indicate that some property has been changed on the ...
0
votes
3answers
43 views

Using goto with DataReader to get sproc return value

I want to get a second-opinion on my use of goto. SqlCommand and SqlDataReader only read ...
2
votes
1answer
40 views

Optimize OrderBy Generic Method

Here is my OrderBy method which includes concatenated column names. Can this be achieved more efficiently? ...
2
votes
2answers
52 views

Random Winner Based on Percentage Weighting

I have 3 variables and each one has their own percentage to win out of 99.99...%. (The 3 percentages don't act up to 100% perfectly) When button1 is clicked, it will go through 100,000 simulations ...
5
votes
2answers
174 views

Type-Safe Event System

I have recently started writing C# from a strong JavaScript background, and found myself wanting to do something I do all the time in JavaScript: events. Since I have a type system at my disposal, I ...
2
votes
0answers
27 views

FindAllReferencesCommand 2.0

Rubberduck 2.0 will feature a "Search Results" dockable toolwindow that will be used for displaying the results of Find all references, Find all implementations, and whatever else we need to find. It ...
1
vote
1answer
38 views

DAL basic implementation using Entity framework 6 and Autofac

Would like to ask for a code review for my DAL. I use Entity framework 6 and Autofac for ...
4
votes
0answers
34 views

About Window in XAML

I just redid Rubberduck's About window in XAML: I do not like my XAML very much. The way I place the StackPanel for the white pane over two rows, only to ...
3
votes
1answer
40 views

Computing the divisor sum in bulk without division, multiplication or factorisation (SPOJ DIVSUM)

SPOJ problem #0074 DIVSUM - Divisor Summation requires computing the sums of proper divisors in bulk (200000 test cases, time limit 3 seconds): Given a natural number n (1 <= n <= 500000), ...
4
votes
3answers
63 views

Allowing internal employees to request supplies

Business rules: This application is for internal employees to request supplies. All requests must be approved my the persons manager. In the database, a manager is an employee, with a self ...
-2
votes
0answers
25 views

Can empty test in c# be clean code? [on hold]

Let's say I have a class with following functional performance test ...
2
votes
0answers
30 views

Message Service

Below is the code to a Message Service. Does anyone have any ideas on how to improve the methods. It doesn't feel clean to me. ...
1
vote
1answer
55 views

Implementing the Actor-Model in C#

After learning the basics (isolated state, communication and computation) of the the Actor-Model I I wrote my own implementation and I'm ready for a through code review. You will be able to see that ...
0
votes
1answer
35 views

Parse a string to get a SectorId

In mobile phones technologies, a SectorId is a 128-bit value broadcast by a 1xEV-DO BTS system. That is a 16 bytes data. I made a structure to store them: ...
2
votes
0answers
32 views

AggregateException handling

How do you handle AggregateException? It is really useful in many TPL or business scenarios, but handling is a real pain. I defined the following three extensions ...
4
votes
2answers
59 views

Prompt user for DateTime

I'm working on a project where I have to prompt a user a enter several dates. This is the code I came up with for prompting the user for the day, month, and year. ...
-1
votes
1answer
27 views

LINQ to SQL code - in models project or in db project

I currently have two projects. One called Models, a second called TaskEntityModels, a model first ...
5
votes
1answer
59 views

Paginating blog posts from SQL server using nested LINQ statements

I made an ASP.NET MVC application using Entity Framework for code-first migrations to the SQL Server database. I also use Unity (DI/IoC) for managing the services and repositories. I made an overview ...
1
vote
0answers
92 views

Observer Pattern with C# and Unity

I want to see if I used the Observer pattern correctly. Right now I'm using a VolumeManager.cs that implements ISubject and a ...
-1
votes
0answers
35 views

performance issue of application using entity framework 6

I have a console application in which I used Entity framework 6. In order to reduce the time of the first instanciation and the first read operations . I used Three ...
4
votes
3answers
279 views

'Retry' mechanism with callback

We've had a situation whereby we have to cater for certain exceptions and retry a particular method whenever these exceptions occur. This is required in various parts of the system. In addition, we ...
0
votes
1answer
62 views

Method or helper function to return objects from EntityFramework with Linq [closed]

The following code reads from Microsoft EntityFramework 6.0 domain model and returns the single view_patient object. The view_patient object is defined in the backend database and uploaded to the ...
3
votes
3answers
58 views

Unit Test Settings

Recently, I redesigned the Rubberduck settings pane. Here is the unit test settings view, which is posted in this question: The part we are referring to is the section in the right pane. The rest ...
3
votes
0answers
47 views

Build an entity, based on a defined model by comparing table column to entity names and building

Can I optimize the BuildEntity method more? ...
23
votes
5answers
3k views

Performance of a Foreach inside a Foreach iterating through a million records

I have two DataTables: dt: is populated from a CSV file with over 1.7 million rows dataStructure.Tables["AccountData"]: is ...
-2
votes
0answers
19 views

Updating the value in column in SQLite [closed]

I want to pass a column2 to a function and update column3 with output of function. I have made func function to calculae the output. When i run the program it only takes last value as input and ...
1
vote
1answer
101 views

Converting from strings to byte arrays with LINQ in C#

I'm taking in a string of input from the command line, and when prefixed by 0o or 8# interpreting it as an octal string. I'd ...
3
votes
3answers
170 views

Finding the 10001st prime in C#

In an effort to learn C# / improve my coding skills, I've started working on the Project Euler problems. I see that I may have been overthinking things a bit after finishing problem 7: By listing ...
1
vote
0answers
29 views

BackgroundWorker in WPF executing multiple methods

I've implemented a BackgroundWorker in my WPF app. My code is pretty ugly though. I've been told to write as little as redundant code as possible. IS there some generic Method I could employ to reduce ...
-1
votes
3answers
93 views

Nullable boolean value with property

Our Sonar code analysis server tells me Boolean literals should not be redundant. Redundant Boolean literals should be removed from expressions to improve readability. Tag: Clumsy and ...
2
votes
1answer
58 views

Windows filepath and filename validation

I have a Windows program that prompts the user to input a file path, and file name. I then check that the file exists with Directory.Exists. Then the user inputs a filename. I check it using this ...
3
votes
0answers
51 views

Struct implementation of immutable Maybe<T> monad

I have developed the following implementation of an immutable struct Maybe<T> monad for use in my game project; as an ...
3
votes
1answer
46 views

Convert reader to list of class

Class Student { Int studentId, List<ClassB> Books, Bool IsPassed } Class Book { Int bookId, List<int> pages } I am creating a list ...
2
votes
0answers
42 views

Generate Subsets Of K Elements From A Set Of Strings

This is the task: Write a recursive program, which prints all subsets of a given set of N words. Example input: words = {'test', 'rock', 'fun'} ...
-3
votes
0answers
27 views

Null Reference Exception was unhandled [closed]

So, as a beginner in C# I started building the black jack game with code only. So after creating the deck class i tested my code to check if it works so far: ...
3
votes
1answer
46 views

Recurring tasks in ASP.NET MVC

I have 2 alternatives for executing recurring tasks in ASP.NET MVC. We just need to add some code in Global.asax First alternative: ...
1
vote
0answers
18 views

WCF service architecture when SQL Server direct table access is not allowed

Part of my job is to maintain an old application written in Silverlight talking to a WCF service which in turn fetch/persist data into a SQL Server database and in a BI cube. Most of the security is ...
2
votes
0answers
80 views

REST Web API Claims / Identity 'refresh' per request

I intend to expose a ASP.Net REST API for a project. I would like to use the default ASP.Net Identity system to provide the SQL backend. Users are managed in a different project. For my REST API ...
-2
votes
0answers
22 views

Running this C# Salsa20 code [closed]

I'm trying to run this code user @scotttyb has posted which is close to this implementation on github. Salsa20 stream cipher implementation ...
2
votes
1answer
58 views

Return most recent DateTime C# Entity Framework

Job -> Many Quotes Quote -> EmailLogList EmailLogList -> Many EmailLogs I want to return a CreatedDate from an EmailLog which has been created most ...
1
vote
1answer
36 views

Linked object for creating chains without lists

I need a LinkedList but unfortunatelly the one that the .NET provides didn't have the functionality I was looking for (not working with linq and the LinkedListNode ...
3
votes
2answers
36 views

Going to the thread pool and back using custom awaiters

I've figured out a way to switch threads in the middle of a method. The benefit of that seems super obvious to me: that's what everyone wants to do anyway, and splitting up methods, using callbacks, ...
0
votes
1answer
38 views

Entity Database Add/Update method

What would be the most elegant way to refactor the following method? ...
2
votes
1answer
67 views

Recursive function application

I use a lot T4 templates and want to avoid extra code writing when it could be generated. Currently I have following class: ...
2
votes
3answers
79 views

Reflection optimization

In a web application I'm working on I have a class that Map objects to other (different) objects. It is implemented with something like: ...