C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.
3
votes
1answer
27 views
Converts a String and a Comma Deliminated String to a boolean
Here is a simple WPF converter method designed, where the object is a string, and the parameters are a string, which contain a set of comma separated values. The program return true if the list has ...
-2
votes
0answers
27 views
Multiplayer game MOBA [on hold]
I want your help in my project.
I want to create a simple MOBA game in Unity.
I have created the login server base C# with sockets connected with MySQL.
I have created the game server base C# with ...
2
votes
1answer
24 views
An Algorithm that Merges, and Sorts two Arrays without mutating one, in two languages
This algorithm, which I have included its flowchart as well, takes an array of A[n] which is unsorted and unmutatable and an array of B[k] which is sorted and includes n zeroes and then merges, and ...
-2
votes
0answers
16 views
4
votes
3answers
201 views
Custom list to avoid out of memory exceptions
The following class is a helper to avoid OutOfMemoryException exceptions being thrown when the list is to large so that it is added onto the large objects heap. To ...
1
vote
1answer
54 views
Mass Link Checker [on hold]
The following code reads a CSV file for image links and checks the links for 200 or 404. The CSV file contains a sku,image url per line. I believe the code works fine however it appears that it may be ...
3
votes
1answer
35 views
Grabbing SQL records: Nullable bool to bool
So I have a method that does a lookup in an existing List<T>, populated elsewhere by grabbing the records from a SQL table holding configuration data for each ...
3
votes
1answer
72 views
Illumination as a way of instantiating new objects
Basically, what I mean by illumination is having a method create an object where the caller supplies all the dependencies. This allows us to hide our new keyword ...
-4
votes
0answers
35 views
1
vote
1answer
53 views
WPF: Model to View Model data binding to implement Two Step View
I am trying to use Two Step View pattern in WPF. The problem is about keeping things in sync – I need a way to data-bind models to view models. Are there any good existing solutions? My approach is to ...
5
votes
2answers
79 views
Packing and unpacking bits
I wrote this class for packing data.
Would it benefit from being named BitPacker rather than BitStream (and change write/read to pack/unpack), or it works as is?
How can I improve it? Any way to ...
3
votes
1answer
60 views
Finding the difference between postal addresses
I have to compose an email where I have to list a list of difference between old and new value of a list of addresses. Only a subset of properties have to be listed, so the first thing that pops into ...
3
votes
0answers
40 views
4
votes
1answer
80 views
Splicing enumerables together
Basically, what I mean by splice is to take an array of Enumerables, take the 1st element from the first one, then the 1st element from the second one, and so forth, until we come back to the 1st ...
3
votes
2answers
44 views
Console Worker Follow-Up
A few hours ago I posted a similar question but this is a follow-up, I have revised the code and added and removed certain lines of code and hopefully improved it a bit, I just brought it here for a ...
2
votes
2answers
31 views
ConsoleWorker update console timer with how long application has been open
earlier I coded a quick console worker that runs a timer every 1 second and updates the consoles timer with how long the app has been open, how can I improve this?
...
1
vote
1answer
54 views
Switch statement to build context menu (with many redundant lines of code)
I have switch statement that is switching on an enum to build a ContextMenu depending on ...
3
votes
2answers
92 views
Password generator and hashing
To generate a password, I generate a key using RNGCryptoServiceProvider. The key is 9 alphanumeric characters long into which I insert a single non-alphanumeric character for a full length of 10 ...
3
votes
1answer
21 views
Immutable File Upload Server Configuration Class (FTP or Network Drive)
The application I'm working on needs to occasionally take pictures, and then send them to either an ftp server or a network drive (user configurable). To try to abstract away the differences between a ...
6
votes
1answer
49 views
Retrieving value from HTML table
Currently all this does is retrieve data from specific columns, the final result will be that I will check the data to make sure that it passes the test cases, but I want to look at this foreach right ...
6
votes
1answer
117 views
Circular Buffer Implementation
I'm implementing a "live analytics" feature and I need to always keep track of the last N items that were added to a collection so I figured I'd make a circular buffer since I couldn't find one.
I ...
1
vote
2answers
100 views
Finding equivalent to % for the inner if clauses
I have a static list of descriptions in a resource and I am filtering down the list based on the index positions of the text in the array
Here is my multi converter:
...
4
votes
1answer
356 views
Serializing a list
I have a ColorFormat class that contains a string format for a color and its format name. In the software, I will define multiple instances of this class and ...
1
vote
1answer
30 views
API class to connect with web php
today I coded a simple API class in C# with just a WebClient instance in each void and just simple voids to do simple things, can anyone give me any support in how I can improove it? Thanks.
...
4
votes
1answer
44 views
Many similar ViewModel methods to fetch and prepare model data
I have a MVVM application that fetches data from active directory and displays it in a DataGrid. The exact data displayed is determined by which query a user runs, ...
1
vote
1answer
39 views
Updating the player statistics text
I'm developing a game in Unity 5.3.5, I have a player statistics system with 10 different stats, as in probably every game the user is able to see the points put in each stats and also the benefit ...
2
votes
0answers
67 views
CodeEval - Lucky Tickets challenge
This a solution to the CodeEval's challenge "Lucky Tickets".
After a failed attempt with brute-force calculations (no surprise here), I have tried to implement an algorithm that I found on ...
4
votes
1answer
320 views
Check if a file exists in a directory or parent
I want to check if a file exists in a given directory or in the parent one, so I wrote this code:
...
4
votes
1answer
72 views
Conway's Game Of Life in C#
In the C# Player's Guide book, one of the challenges was to make the game Game of Life in the console.
Program.cs
...
4
votes
4answers
146 views
Implemenation for concurrent file access (read/write)
I am developing an application that works with files and folder on a network share (similar to the windows explorer). The application is used by multiple users and provides some commands for modifying ...
7
votes
1answer
129 views
Extension method splitting string on each capital letter
Hello I'm creating my own game and for some statistics I need to get the names of specific objects, the problem was that I had them declared like this SmallFireBall but I wanted them to appear like ...
2
votes
1answer
32 views
Data Access Layer to return Data Transformation object
I am trying to create a Data Access Layer using ADO.Net. I have created a generic method for ExecuteNonQuery. The stored procedure I am calling will return two parameters. The output parameters from ...
4
votes
1answer
60 views
Recursive Breadth First Search Knights Tour
This program was written on Windows 7 using Visual Studio 2012 Professional. Some of the issues encountered may have been fixed or changed in a more recent version.
This is a quote from my second ...
5
votes
1answer
62 views
PigDice game in C#
In the C# Player's Guide book there's a challenge in which you have to write the PigDice game in C#:
It's a multiplayer game, every player starts with score 0.
Player X rolls 2 dice.
Player ...
1
vote
3answers
64 views
Instantiating a property when the required attributes have been set
I have a simple class which holds my product. Someone can add a serial to this product and also a purchase id. On change of the properties, I want to check whether both properties are set, and get the ...
4
votes
1answer
53 views
Reading and displaying an image from a folder
I have a question concerning the correctness of the reading and displaying the image in ASP.NET Core MVC web application.
This is the way I am reading image names from a specific folder (I am using <...
2
votes
1answer
36 views
WPF - Run an async Task with DispatcherTimer
I have a small application that checks some system status and display it details.
I have the following code which is working. But I want to make sure it's optimal:
...
5
votes
3answers
228 views
Finding the duplicate with an array with 1,000,000 integers between 1 and 1,000,000
I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was:
Given an array with 1,000,000 integers between 1 and 1,000,000, one integer is in the array ...
12
votes
6answers
2k views
Find the first non-repeating character in a string: (“DEFD” → E)
I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was:
Find the first non-repeating character in a string: ("DEFD" --> E)
I didn't pass the coding ...
3
votes
0answers
53 views
Use of Async/Await for EventHandlers
I have a MVC WinForms application. I am using Dependency Injection with Ninject as the IoC container.
...
1
vote
0answers
47 views
0
votes
0answers
27 views
Bootstrapped tabbed table view
This produces tabbed tables.
Here's how it looks:
Each table displays comments of E-commerce products. The variable dtProductComments is ...
5
votes
3answers
125 views
Console RPG - show cycle optimization
I have this RPG game and this has elements such as the map, the monsters and the items. The monsters and the items are stored in Lists and every time I want to show ...
4
votes
1answer
48 views
Active Directory Tool - Wpf application to query active directory and display results 2 (UI)
This is an update from here. I have made some changes, and have decided to only include the UI side of things in this particular question. I wanted to make the application follow the MVVM pattern, but ...
8
votes
4answers
168 views
Project Euler 4: Largest palindrome product
This solves Project Euler 4: Largest palindrome product using C# (specifically, using LINQPad). Any and all suggestions for improvements to either the C# code or the math/algorithm are very welcome.
...
5
votes
3answers
1k views
Job pipeline application
We have a console application which runs to perform an incremental load of our data warehouse staging area, with data from a number of production databases.
The source database don't necessarily have ...
2
votes
1answer
71 views
Moving a player around a board, by choice and by chance
Recently I had to add 2 different sets of logic for moving my player around the board. One lets the player pick a location and move him there while the other uses a dice. I'm reusing code for both ...
4
votes
3answers
108 views
Parsing remote text file and inserting into database table
I did run this code through StyleCop. Goal was to optimize the reading, parsing and inserting of a file on the web and write the rows to a database table using a stored procedure. Contrast this (...
7
votes
1answer
84 views
GET with paging, sorting and filtering
I have a GET method that handles paging, filtering, and sorting. Development has been fairly rapid and I'm not completely sold on some of the implementation. A few assumptions have to be made for this ...
3
votes
5answers
641 views
Class with TryParse static method
I am receiving and Expression (String) as follows:
String expression = "+name;-age;-city";
I parse this expression by splitting it using ...