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

0
votes
0answers
11 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
2answers
204 views

C# 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
0answers
29 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
24 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
30 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
17 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
18 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
5answers
598 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
32 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
281 views

Resumable HTTP download class

Any suggestions, corrections and advice would be very nice and much appreciated. ...
2
votes
2answers
139 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
112 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
49 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
176 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 ...
1
vote
0answers
59 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
39 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
23 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
71 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
62 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 ...
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
79 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
141 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
42 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 ...
-5
votes
0answers
39 views

Asynchronous operation in WPF application [closed]

I am writing an C# WPF application, which should periodically prepare some data and send them to WebService in background. Here is my excerpt of code where I call operation asynchronously. Please ...
-1
votes
0answers
68 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
84 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
50 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 ...
9
votes
2answers
199 views
+50

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
70 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
54 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
87 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
34 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
202 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
241 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
42 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
106 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
56 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
124 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 ...
6
votes
2answers
151 views

After-school service for students

I have to show a select control of students with event information where Monday, Tuesday, Wednesday, Thursday and Friday are Events. (Independent buttons). The ...
-5
votes
1answer
66 views

Date Range Tree

...
0
votes
2answers
53 views

Creating multiple objects from SQL server extract

I've created a simplified prototype solution as a sort of proof of concept before starting a larger program. Here is the test data used to build the objects: ...
3
votes
3answers
193 views

Simplifying Cryptography Key Generation without Losing Security

I am writing a helper class for encrypting string and other data types. My goal is to make it as easy as possible to use, while still keeping a substantial amount of security. One issue I struggled ...
7
votes
1answer
83 views

Dynamic network messaging

I'm building a client and server for a game but wanted a generic messaging system in a shared library that let me focus on application logic and was largely separate form the underlying networking I/O ...
11
votes
2answers
132 views

Implementing Dynamic Network Message Handling

I'm trying to handle network messages in a dynamic, and effective way, though I feel I've overthought it again. As of now, I have a very structured approach, but it feels as if it's a lot of overhead ...
6
votes
1answer
48 views

Connect 4 (glorified tic-tac-toe) implementation

I'm posting here my implementation of the game Connect 4. It's obviously a pretty trivial game and code but I'm primarily interested in any advice concerning improvements to the code structure: types, ...
6
votes
1answer
69 views

MVC4 approach to checking authorization after POST

I have a very simple form that is designed to update account expiration dates. I'm currently creating a View Model and sending that to the form, however, I still have to pass along a GUID so I know ...
7
votes
2answers
106 views

User Password Encryption in C#

I am maintaining an old codebase of one of our legacy .Net applications which has a component that encrypts and decrypts user passwords using symmetric key cryptography. Since cryptography is not my ...