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

3
votes
1answer
41 views

Web job logger implementation

Interface for logger: ...
1
vote
1answer
43 views

DatabaseManager and connection in C#

I am posting here to get a code review on my DatabaseManager and DatabaseConnection classes, and for answers on how I can improve. I won't spend too long drolling on, but this is a database manager ...
0
votes
1answer
34 views

UserInfo information class with a database

I am no expert in C#, the opposite really, I just wanted an overall review on my UserInfo class that gets user information from a database using MySQL. I was also ...
6
votes
2answers
193 views

Finding binary combinations based on substitute wildcards

I am given a string containing the possible characters of : 0, 1, and ?, iterating over ...
2
votes
3answers
71 views

Method that returns an integer chosen by user

Can I make this: if (oneFour == 1 || oneFour == 2 || oneFour == 3 || oneFour == 4) shorter, especially if I'm gonna need a wider range of integers? Do I need to ...
1
vote
1answer
22 views

Resumable HTTP download class - Follow-up

Is there a better way to calculate the download speed than what I'm currently doing now? Are there any suggestions on improving the updated code? Pure version: ...
8
votes
1answer
51 views

IoC Registration: Convention over Configuration

The rubberduck project has reached a turning point. The core features are implemented (except the SmartIndenter embedding - we're keeping that for 2.0), the next few releases will probably just build ...
4
votes
1answer
79 views

Finding out which user has made the most progress

I have some code to accomplish the objective of finding out which user has made the most progress. Progress is measured in integer values, the higher the better. ...
4
votes
1answer
49 views

Project Euler 42 - Finding triangle numbers

Here is my solution for Project Euler Problem 42, which is described in the following: The \$n^{th}\$ term of the sequence of triangle numbers is given by, \$t_n = ½n(n+1)\$; so the first ten ...
0
votes
0answers
21 views

Checking size of StorageFile stream before writing to it [on hold]

I want to write to a StorageFile in Windows Phone 8.1 (using C# libs). I have to open a stream before I can begin writing, and I get the size of the file from the stream. I want to see that if the ...
5
votes
4answers
295 views

Conversion of hexadecimal string to string

Given a C# string which is a set of hexadecimal numbers such as: string HexString = "202048656c6c6f20576f726c64313233212020"; Where those hexadecimal numbers ...
1
vote
1answer
61 views

Get list of unique parents from childrens list

Parent has list of Children. I only have access to the list of children. I need to get list of unique parents from the List of ...
-1
votes
0answers
25 views

Getting, Processing and returning a update collection [on hold]

Self explanatory code here, This is just an example of what I am doing, had to change names and remove irrelevant code to make it as short as possible, ...
0
votes
1answer
36 views

Delayed Include rules for EntityTypeConfiguration using LINQ expressions

The aim of this class is to set rules for including navigational properties on Configuration level and then apply where needed in the code. I've decided to store expressions in the list for different ...
-1
votes
0answers
22 views

ormlite and mongodb c# driver performance comparison [on hold]

I am currently using servicestack Data is stored in MongoDB For performing CRUD operations from servicestack I am using Mongo DB C# Driver Is ORMLITE more efficient than Mongo DB C# Driver? I ...
2
votes
0answers
27 views

WPF MVVM Dialog with Prism, MahApps.Metro

I am building a Metro-themed WPF application with MVVM approach using Prism and MahApps.Metro. I have to show a custom dialog from view model. Currently, I am using ...
10
votes
4answers
759 views

Method to count all comments in single external C# file

I recently had an interview question: Write a method that counts all comments in a single external file. It was a timed question and I wanted to know if this is the best way to accomplish the ...
3
votes
1answer
35 views

Unit-testing an RSS feed parser

I'm working on a class to parse RSS feeds using SyndicationFeed. (related to Downloading data using HttpClient). I'm trying to write this so it can be unit-tested, ...
6
votes
4answers
320 views

Resumable HTTP download class

Any suggestions, corrections and advice would be very nice and much appreciated. ...
3
votes
2answers
146 views

CRUD operation class

This code is a chunk of big project, so I am sorry in advance for not adding everything as it's just not possible. ...
6
votes
1answer
120 views

Custom ViewModel to check property existance prior to update

I have written an abstract View Model which all my other View Models inherit when I write any apps in Silverlight, WinRT, WPF etc. The class was written to attempt to address an issue I have run into ...
2
votes
1answer
52 views

Downloading data using HttpClient

I'm working on a class to download some data from an external server and feed it into my data model. I'm new to both HttpClient and ...
10
votes
6answers
3k views

Writing the condition x <= y AND x > 0

My current condition is written as follows: ...
5
votes
1answer
188 views

Preparing a YouTube downloader based on Windows form

The program this function was written for is a Windows forms program. This function downloads videos from the internet one after the other. It runs in a separate thread (so the user can drag the form ...
2
votes
0answers
63 views

C# port of data mining algorithm much slower than reference implementation

I was trying to implement the algorithm specified in this research paper (please ignore the math, since it's irrelevant to the question). This algorithm is very basic in formal concept analysis. The ...
3
votes
3answers
2k views

Secure Encryption Algorithm

The algorithm gets the number associated with each char, then adds a random number to it and saves the numbers it added. I plan to make an ...
-1
votes
1answer
42 views

Repeated Code - What techniques can i employ to ensure there is no repeated code in my application?

C# - The application works fine but I would like to improve the organization of my set of codes by ensuring there is no repeated code, I am struggling to figure out what methodologies can fix this ...
3
votes
1answer
27 views

MEF Execute Plugin Exports in Threads

I am developing a service application that would implement a peer to peer messaging system. I am wondering if my following code is the best approach. It works, but I am naive and it would be nice to ...
6
votes
2answers
82 views

Finding a gameObject on a screen

I'm working on a warning system for my game. I want to display an arrow on the screen where the object is going to be coming from. Here is an image of what I have in mind: The object will spawn ...
4
votes
1answer
64 views

Downloading all files in a FTP folder and then deleting them

I've created two methods in a class that allow me to download the contents of an FTP folder and if specified then delete them. Although the code operates as intended I think it's vastly bloated and ...
3
votes
0answers
25 views

Redirecting a user

When the user clicks the first button ('Back to List' button), I redirect the user to the Employee List page. Can you please review this and suggest if there is any better way of achieving the same? ...
2
votes
2answers
52 views

Grab set of data from database that matches userid and return it to the view

I want to get the row of data that matches the user ID I have. Then I want to return that view to my view to be displayed in my textboxes for editing. Here's the action that gets called when a get ...
-1
votes
0answers
52 views

Raffle Draw Program in c# [closed]

I want to create a console program that simulates a raffle draw. It should be able to do the following: Enter the number of students Allow the user to input the student's names (only after asking ...
6
votes
3answers
83 views

Monkeying around with Survey Monkey and Asp.Net Mvc

Intro I've been a desktop dev for a long time now, and have never really had to monkey with web development until very recently. I have a need to do some custom integration with Survey Monkey's Api ...
6
votes
2answers
145 views

Checking winning conditions in Tic-Tac-Toe

This code checks winning conditions in Tic-Tac-Toe by checking if there is any row, column or diagonal with the same symbols. The board is a 2-dimensional array of ...
7
votes
1answer
45 views

Unit test code for Antlr Grammar

I'm working on a grammar for the Visual Basic for Applications (VBA) programming language. I've discovered a way to make assertions about how a parse tree should be generated by using the Antlr ...
-1
votes
0answers
69 views

Airline scheduling simulation

I have a simulation system that simulates airline scheduling. There are different entities representing flight, airport, gate etc. There are also many algorithms and the whole system is run using a ...
-4
votes
2answers
89 views

Is the following if statement unnecessary?

I have a small piece of code that checks some data but I suspect one of the if statements is unnecessary: ...
0
votes
2answers
51 views

Get neighbour sides of a Rubics cube

I'm writing 2x2x2 rubics cube simulator. In my code I have a concept of Face which is individual side of the cube, and State which is agregate of all six sides. When I create new State, in addition to ...
10
votes
2answers
236 views

Chaining asynchronous tasks that must run sequentially

I want to implement an Agent-like object in C#. An Agent wraps some memory location (ideally storing an immutable object) and receives updates to that location. All ...
5
votes
1answer
73 views

Reading a pointer to a string

What it is doing basically is reading an std::string from a given pointer. I was told that using a StringBuilder as I am is not ...
5
votes
1answer
57 views

Annotate a class's important string value via an attribute

I have some Field objects that need to be serialized. Their primary string identifier is called a Tag and starts with a number, so it's not suitable for use as a class name. Thus, for a field bearing ...
5
votes
2answers
89 views

Every year is like a loop. A nasty, nested one

Quite a little while ago, I wrote a VBA macro to generate fiscal calendar date records. That macro did the job all this time, but I needed to be able to generate fiscal years from an ETL overnight ...
2
votes
1answer
35 views

Implementing SQL function STR

I am writing a piece of code in c# that mimics the behaviour of following SQL function STR in the following case: ...
4
votes
3answers
204 views

Algorithm to group connected graphs

I am working on an algorithm, which should group connected Arcs. The situation is described via code examples below. I have Arcs: ...
5
votes
1answer
243 views

Fastest De-/Serialise struct in .Net

I wrote this code to De- and serialise structures afap using IL generation (comments describes C# analogue). What can be improved here? ...
2
votes
1answer
44 views

Framework for comparing database objects

This code allows me to compare two complex objects, which are stored in a relational database, to see what has been removed from the objects. These objects have a unique integer primary key. They ...
7
votes
3answers
113 views

Implementing Dynamic Network Message Handling (Part II)

This is an iterative review request of this other question I posted. As a follow up to that previous question, I changed the pattern completely and I went to an events-based approach, which might be ...
2
votes
1answer
57 views

Thread-safe removewhere

I'm trying to implement a HashSet that it's accessed from different thread for querying, adding or deleting elements. It doesn't make sense to use a Dictionary for I got several search keys so I won't ...
6
votes
1answer
125 views

Building an IDE, block by — er, mock by mock

The opening sentence of an answer I received in my previous post snowballed, and led to completely ditching the previous approach. Mocking my IDE with a MockFactory ...