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
1answer
19 views

Transliterating encryption/decryption code from python to C#

I'm attempting to transliterate a piece of encryption/decryption code written in python into C#; the code works on save data from a particular game. I can't code in python at all, but by referring to ...
4
votes
0answers
31 views

String deformatter

The following class (Deformatter) is able to revert most text generated by String.Format. To accomplish this, it similarly relies on a format parameter – with type ...
0
votes
0answers
13 views

Splitting two ObservableCollections lightning fast

I'm working on wiring up a bindable Map for Xamarin Forms, and I need a fast way of dividing up the ObservableCollections (collection of map markers) as quickly as possible. Collections are a weak ...
1
vote
0answers
15 views

Pattern-matching-esque code

I've come across a need for code like this a few times - you have an object (or objects) that may or may not have certain properties and values within those properties. Consider a program with ...
1
vote
2answers
52 views

Sample repository class

How can I make it shorter and cleaner? ...
4
votes
0answers
47 views

C# Wa-Tor Simulation - Making my code more object oriented

I tried this as a programming exercise. Its working as intended, but I feel like the code is a mess and I could have used the advantages of object oriented programming much more (like inheritance for ...
7
votes
0answers
21 views

Wrapping the Sage300 View API with… a Repository

Related: Something like a LINQ provider I needed to work with the Sage300 View API. I had never worked with it, but my first impression has been that the API is ...
11
votes
2answers
79 views

Something like a LINQ provider

Ok, before you ask: yes, I need to do this. Sort of. I'm wrapping a 3rd-party API for data access, and I can't use an ORM, so I'm implementing this kind of thing: ...
0
votes
0answers
16 views

Umbraco Examine Search for Full Site

I have a macroscript which reads a query string for search term parameters, and then does a multiple word GroupedOr search through UmbracoExamine / Lucene.NET. Because this is a full site search, I ...
0
votes
0answers
21 views

Adds digital signature to outgoing TCP packet

The code connects multiple clients to a server using TCP sockets asynchronously. I have added code to attach a digital signature to the outgoing messages from the server, to authenticate the message ...
0
votes
0answers
25 views

Removing/adding/updating items between 2 dictionaries based on 3 rules

I need to do 3 things: Remove entries that are not present in dic2 from dic1 Update the other data in ...
1
vote
1answer
30 views

LINQ statements that aggregate sums from a List of objects

I'm packaging data for use in a JavaScript charting library that expects a somewhat odd structure of data in which there is an array of labels and an array of ...
4
votes
5answers
180 views

Pass Triangle challenge

In order to solve this challenge: Challenge Description By starting at the top of the triangle and moving to adjacent numbers on the row below, the maximum total from top to bottom is 27. ...
1
vote
0answers
23 views

Aync await TCP Server for concurrent connection [on hold]

I have to write asynchronous TCP Server on to which multiple GPS Devices will be connecting simultaneously (Count :- 1000 Approx) and will push some data of size less than 1 Kb on server, In the ...
-3
votes
1answer
60 views

Message validation rules

I wonder if I should divide this class into two, since it contains two "ifs" with different messages. Would breaking it down be in keeping with the "S" of SOLID? ...
1
vote
1answer
22 views

Using [ChildActionOnly] for generating links

I have a view which displays a list of items, in each row I'm going to have a link, a link in each row points to different location So base upon a property called ...
0
votes
0answers
38 views

How do I compile time enforce domain values go into the dal? [on hold]

I'm hoping to find a way to solidify the compile-time safety of calls into the domain layer. but any suggestions/ideas are welcomed. Schema.generated.fs ...
2
votes
2answers
67 views

Is % needed when calculating template page numbers?

I have the working function below, which sets the text to a label displaying currect active "products" and current active pages. The label displays "X products, Y pages/page" depending on the amount ...
2
votes
0answers
77 views

A redundant data service

I've got a service that loads data from a databasr and it performs almost the same operations in all methods. ...
1
vote
1answer
57 views

Unity3D script for controlling a character

This is a Unity3D script I wrote for my game to control a character. I don't consider myself a highly-skilled coder, so I come here to ask for suggestions. Is my code clean enough? How can I improve ...
0
votes
1answer
43 views

Custom Exceptions based off the Visual Studio snippet

I'm creating my own application exception types so I could catch them higher in the call stack and take specific action. I'm looking to get feedback on the latest exception I've written for two ...
0
votes
0answers
26 views

How do I get a change list from two dictionaries in one direction? [on hold]

I have two dictionaries of information, one dic comes from a database and another dic comes from local devices. I have a method that compares whats on the local device to whats in the database. If ...
1
vote
1answer
23 views

Build String from Checkbox List [on hold]

I have a search app that has 2 pages and uses a master page. A number of asp.net controls reside on the default page and I need to get their selected values to a label on the results page. I am ...
1
vote
1answer
76 views

Buffered asynchronous writer

Imagine I have connection in which I have to write numbers, represented by this contract: ...
1
vote
3answers
80 views

Pascal Triangle implementation in C#

This is my attempt to implement the Pascal Triangle in C#. It is meant to calculate and return a pascal triangle of size n (which it takes is through the parameter ...
2
votes
0answers
25 views

Transform and transpose byte[] of 32bit image data in 24bit array image data

I would like to know if someone can think about a better solution for doing this stuff. I have an array of raw bitmap data in 32bit format (RGBA). I need to transform and transpose this array into a ...
29
votes
4answers
4k views

OO coffee dispenser

This picture inspired a contest between a few of my friends to rewrite this code in more proper OO style. This is what I have come up with. Any thoughts: ...
3
votes
2answers
68 views

Parsing data from text with repeating blocks

I am parsing the responses from our Varnish load balancers in order to monitor the status of various nodes. One of the responses we get is text consisting of multiple blocks of data, one for each ...
2
votes
4answers
133 views

Consecutive whitespace reduction

I pursued an according algorithm with an absolute best performance, the following class embodies the solution. Any comment is welcome. ...
0
votes
0answers
21 views

Can this implementation heavily harm write performance? [on hold]

For some reason I need to reimplement a method of this interface: Task Save(ISagaData sagaData, Dictionary<string, string> sagaAuditMetadata); This is the ...
4
votes
1answer
55 views

Randomly choose a game executable from a folder

I've written a Universal Windows Application which allows you to select a folder and shows the icon and name of a random executable from anywhere in that folder. The intent is to be a Game Roulette, ...
10
votes
3answers
1k views

PIN class with SOLID principles

I wrote this Pin class as a part of a project to learn SOLID. What do you think about it and what can be made better? Interface ...
6
votes
1answer
51 views

Cancellable UI loader

I'm playing with async/await, but I have yet to discover a standard method to safely cancel an intensive task. I have tested the following, and it works exactly as intended, though I remain unsure if ...
3
votes
1answer
50 views

Unit of Work and repositories in MVVM / Windows 10 app

I’m currently aiming to make my first app for the Universal Windows Platform (UWP) / windows 10. It’s a small app but should follow some best practices patterns (although I’m considering it as a first ...
6
votes
1answer
45 views

C# Regex to extract bug ID from Bugzilla JSON response

I have written a series of Regex.Replace() lines to take an input like {"id":36} and convert it to ...
6
votes
1answer
54 views

Populating a listbox in a mock invoice with selected items

So I'm almost 100% certain I've done something wrong simply due to the inefficiency of what I've written, I'm entirely a novice to coding and am working on an assignment for my introductory ...
4
votes
4answers
681 views

Calculate odds of winning (UK) Lottery jackpot

I am interested in calculating odds of winning UK Lottery. The format is that 6 numbers from 1-59 are drawn. I am interested only (at this stage) in the odds of winning the jackpot (matching six ...
4
votes
0answers
35 views

Method for obtaining adjacent chunk positions

I'm currently in the process of making a 2D tile based game. This game has an "infinite" world that can be traversed and modified as needed. I am creating the chunks with a mesh and I apply a texture ...
-2
votes
0answers
28 views

C# Exception Handeling To Check Empty Text Boxes [closed]

I am making my first Area and Perimeter Calculator. I would like to make it so when the user forgets to enter text in the text box(s) or doesn't give anything but hits the Calculate Button anyway that ...
6
votes
4answers
117 views

Unit Testing the Duck

I recently reinstated the unit tests in Rubberduck. Previously, our parser was a synchronous parser, with everything running in sequence, and we could just request a parse result. Now, however, it ...
1
vote
1answer
66 views

Getting employee details according to the role

Here is my issue.I have two classes: ...
6
votes
1answer
124 views

A* algorithm in C# for use in a game

I recently started up again on a 2D game engine I have been working on over the last couple of years. I managed to implement a version of the a* algorithm that seems to work fine for my game, but it ...
5
votes
1answer
139 views

Encryption Algorithm in C#

I'm coding a "encryption" algorithm for learning and and don't know how good is it or how could I make it better: ...
3
votes
1answer
62 views

Easly cancellable operations WPF

Several times we need to be able to revert the data the user is inserting to a previous state (cancel data update). In order to keep DRY and for the sake of separation of concerns I thought about a ...
2
votes
3answers
84 views

Task with feedback dialog helper class

I'm currently working in a Windows.Forms project where its very common that I need to show a responsive feedback form while a task runs. These tasks take typically ...
1
vote
1answer
50 views

Browse Folders for Videos

I am a self-taught programmer and would love any advice / suggestions. I wanted to implement some sort of n-tier Architecture, but not sure how to move all my code around. My program will take movies ...
4
votes
4answers
269 views

Swapping characters pairs in a string

I have to swap the characters in a string before sending said string to a device to show the information sent through a LCD, the method I developed is as follows: ...
0
votes
0answers
43 views

Optimizing LINQ with SelectMany aggregation

I have the following query which appears to be a bottleneck in my app: ...
-1
votes
2answers
72 views

Calculating whether movie times overlap

The goal of this example is to find if movies are overlaping. What is the Big O complexity here and how can I calcualte it? Is there better way to write it simpler? ...
3
votes
1answer
63 views

Removing all delegates from an event dispatcher

Given a class which is an event dispatcher whose underlying store is a dictionary of events whose key is the event type ...