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

1
vote
0answers
18 views

Task scheduler for a particular application

This isn't meant as a scheduler for just any job. The job that I need to schedule here is very specific for an application I'm writing for one of my clients. The scheduler will run as a console ...
4
votes
1answer
42 views

Insert String array as label content in datagrid row through radio button

I have written some code for inserting a label at runtime that has its content set to a string array into a datagrid row. All of this will initiate when certain radio buttons are checked. The code is ...
-2
votes
0answers
42 views

Inserting employee records

There is nothing wrong but any other nice way to re-write the below program ...
-1
votes
1answer
31 views

Piggybacking namespace pros and cons [on hold]

I was wondering of there are any disadvantages to piggybacking namespaces in c# when creating extension methods. So for instance , I have a class being referenced by the main project as well as the ...
0
votes
2answers
94 views

Seemingly redundant conditionals…or not?

I'm working on some code that has the following pattern of conditionals inside it. It doesn't look great, but it doesn't look terrible. Please, shed some light on the underlying reason this is not ...
-4
votes
0answers
19 views

image to array / array to image, very strange display behaviour [on hold]

I am creating a custom Byte[] array from an image, Then i turn back that array into an Image and display it into a PictureBox. ...
8
votes
4answers
744 views

Basic text-based rover game

I've made a small "rover game" similar to this one, except made in C#, using OOP, and prettier menus. Here's how it works: There is one Rover class which is ...
6
votes
4answers
95 views

C#/.Net 4.5 - Number Guessing Game

I'm currently enrolled in an introductory C#/.Net 4.5 course and one of the things I want to focus on is the quality of my code. This is the first assignment our instructor had us do, the ...
10
votes
4answers
616 views

Imaging with getPixel() and loops

I wrote perfectly working code that reads an image, and then does a kind of threshold on it by zone. If the zone has too much white then it turns all the zone into white, otherwise it turns into ...
4
votes
0answers
55 views

TPL inside Windows Service C#

I need to perform few tasks inside a Windows Service I am writing in parallel. I am using VS2013, .NET 4.5 and this thread ...
5
votes
3answers
106 views

ImmutableList implementation in C#

I tried to implement an immutable list. ...
8
votes
4answers
647 views

Printing an Alternating Pattern to the Console

For this assignment, you will create the pattern of a chess board that is 8 x 8. Use X and O to represent the squares. Create the appropriate nested looping structure to output the ...
2
votes
2answers
49 views

Users and friends query with retry, returning JSON

I am new to Azure and SQL. I have the following function that is part of a larger Web-API which is hosted on Azure and is querying an SQL Server database that is also hosted on the Azure platform: ...
2
votes
2answers
68 views

Class for easier to read IProgress<Class> handling (Version 2.0)

This is an update to my question Class for easier to read IProgress handling and includes the suggestions from @svick, with one exception. It was also suggested to change the setter for ...
-2
votes
0answers
31 views
4
votes
2answers
53 views

Extracting a number from provided URLs inside a text file

I need to extract a ID (int number) from a Url. Example: http://www.example.com/foo/bar/12345 For this I wrote 4 methods where the first one ...
10
votes
1answer
145 views

Here's my interface, so call me …maybe

I'm inspecting VBA code to find obsolete code constructs - namely explicit Call statements, like this: Call DoSomething(42) ...
2
votes
1answer
41 views

Regex in combination with file compare

I have made a funtion to compare text files line by line, where timestamps and jobnumbers are replaced for a identical string. By lack of experience I'm not sure if this is the best way to do this. ...
4
votes
1answer
41 views

C# Chat - Part 2: Client

This is the second part of a multi-part review. The first part, the server for this client, can be found here. I've been building a simple C# server-client chat-style app as a test of my C#. I've ...
3
votes
2answers
47 views

Composing terminal control sequences

I've seen everybody claims the nested ternary to be an evil even when an operation couldn't be written with switch-case; and here's even more, my code could be easily written with switch-case ...
2
votes
1answer
30 views

Type Name or Alias via Reflection for TT Code Generation

I was working on some TT code generation to get rid of mundane C# codings in VS2013 Express Edition, and after researching online, created the following helper methods to facilitate Type declarations. ...
5
votes
5answers
172 views

Performance of object-to-string conversion

Using an OR/M I map a lot of rows from database to array of objects (~300k). In these objects some properties are marked with special attribute [Signed]. Row-by-row ...
1
vote
1answer
25 views

Approach to MVC 4 windows group security to enable/disable controls in view

There are 3 window groups to add users and the application uses MVC 4. Here's my approach to add security attributes to my controllers and pass user's role to the view in order to enable/disable ...
5
votes
3answers
60 views
6
votes
1answer
111 views

Code Inspection: Procedure not used

Here is yet another piece of Rubberduck code, this time the nasty ProcedureNotUsedInspection class, whose role is to identify all procedures that are never called ...
1
vote
1answer
51 views

Is this the best way to check sorting (in recursion) without loops?

Please let me know if there is a shorter way to do it again without any kind of loops. Recursion only. ...
-1
votes
1answer
77 views

Using async & await

I've been experimenting with some old code that needs refactoring in places and was testing if there was any improvement to iis threads etc by uploading file asynchronously (Server Side). I'm using ...
1
vote
2answers
121 views

C# Chat - Part 1: Server

I've been building a simple C# server-client chat-style app as a test of my C#. I've picked up code from a few tutorials, and extended what's there to come up with my own server spec. In this post ...
3
votes
1answer
78 views

Custom iComparer

I've got a base class GraphUIControl which is inherited by 4 child classes: BubbleGraphUIControl ...
-1
votes
0answers
37 views

how to reduce calculation time in foreach loop

How can I improve this code to reduce the calculation time using a foreach loop? The problem is that it take more time to calculate answers. ...
7
votes
2answers
138 views

Search for Tree

Here is a search implementation for my tree. It searches each node in a breadth-first manner first, but it goes deeper in a depth-first manner, in the event it needs to go deeper. I know there may ...
3
votes
2answers
60 views

C# Tree implementation

I’m working on a C# implementation of a tree class. The tree will be used wherever I need to store data in a tree format. (Application Menu, File Infos etc.). Therefore the tree should support a lot ...
3
votes
1answer
61 views

Pitting two Blackjack bots against each other

I'm taking part in this Daily Challenge on http://www.reddit.com/r/dailyprogrammer/comments/29zut0/772014_challenge_170_easy_blackjack_checker/ Basically, you have to develop a program that runs two ...
2
votes
0answers
22 views

Route factory which creates instances based on database context and model

I am trying to bridge the gap between the database context and routes that are stored in the database. The factory is designed so that when used in other assemblies, you are forced to use the ...
2
votes
1answer
45 views

String extension method that truncates at sentence punctuation

I've received a request at work and the senior developer is away on vacation so I can't ask him. The request was to truncate lengthy article titles while maintaining readability. In other words, don't ...
-2
votes
2answers
171 views

Socket server class [closed]

I am trying to build a high performance socket server and this is what I have come up with so far. Can anyone please review my code and see if I can make any improvements on it? ...
7
votes
2answers
129 views

5 Customers, but only 1 Bank Teller

Recently, as part of an interview, I was given a (seemingly) simple code prompt: To simulate a Bank with 5 customers and one teller, allowing them to deposit to and withdraw from their accounts, but ...
0
votes
0answers
35 views

Parallel data processing [closed]

I am trying to use Tasks to do some data processing in parallel. It will be constantly running. It reads from a queue file and if there is data to process the task will start. Once the task stops ...
5
votes
2answers
115 views

Unit Tests for getting the first Monday of the month

I have an application that runs hourly, and I want to use it to also send an email at the start of the day of the first Monday of the month. I searched and found information to help me code what I ...
1
vote
1answer
35 views

Generic repository object design + static DAL helper

I would like you to review the solution I came up with to the following scenario: In attempting to model a generic Repository object (that receives a generic type parameter) to interface with my ...
0
votes
0answers
17 views

Change Task Edit form of workflow in SharePoint 2010

I want to change task edit form of the workflow when approver want to approve/reject task. I have created some code to change task edit form. Please review and suggest me improvement. Or it will be ...
3
votes
2answers
78 views

Airline seating algorithm: how to seat a passenger in mirror image to previous allocated seat

I have a seat allocation algorithm for an airplane 30 x 6 seats. The plane is 'split' front (1 - 15) and back (16 -30), right (A,B,C) and left (D,E,F). I am placing passengers in window seats front ...
9
votes
3answers
385 views

Data Access Layer code for MSSQL Databases

We use this class quite a bit for boilerplate / glue that allows web services and applications to call databases. This code is very important, and I'd like to ensure I'm getting the best performance ...
2
votes
1answer
36 views

Extract incomplete weeks from a DateTime collection

The code below attempts to extract incomplete weeks from a List<DateTime>. For example, a list containing all the days in Jan 2015 would result in the 5th to ...
0
votes
1answer
26 views

Check if modelitem refers to currently logged in user with mvc identity

I'm using MVC in order to generate a couple of views within my webpage. For a way of logging in, I've decided to use Asp.net's Identity, which I am very happy with. However, I'm trying to find an ...
0
votes
0answers
23 views

ControlContent navigation within wpf mvvm application

I have a wpf&&MVVM application, in which I have a problem in responsiveness: I have a ContentControl to be changed in the click into a menu In The view ...
3
votes
2answers
91 views

Census data from file input (text)

The program takes census data from a text file in the format age, gender, marital status, district. It then gives a list of residents by district (there are 22) and by 5 age groups. Any suggestions ...
2
votes
1answer
45 views

Shared access point

In my game, people connect to my server. The server creates a GamePeer per connection. GamePeer creates one ...
4
votes
1answer
68 views

Passing a password to a viewmodel

I've got a project I've been working on that connect to a file server and writes some data to a text file. In order to do this I added a textbox for the user to type their username and a passwordbox ...
5
votes
3answers
175 views

Login and registration functions

I'm currently learning C# as first programming language and I've made a simple program to exercise the basic concepts. It's nothing fancy especially compared to advanced stuff you normally talk about, ...