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
6 views

Safe async API code

I'm pretty new to async/await and I want to ensure that the code I've written is going to be safe and not cause any deadlocks. The RestClient in the code will be ...
0
votes
0answers
9 views

Excel-to-JSON parser

I just wanted to build a simple converter from an XLS Excel file to JSON. I have predefined JSON format. All fields except of two - are just simple mapping from Excel to JSON. The two fields have a ...
0
votes
0answers
6 views

Optimizing timeline generation

I have a bunch of processes that are being executed on different virtual machines. All of those processes have a StartDate, ...
1
vote
1answer
18 views

Method for get base URI

How can I improve the following code? ...
2
votes
2answers
33 views

Instantiating different kinds of error records for a database operation

I've written code to be called from Powershell like so: Rename-DatabaseUser -Name 'someuser' -NewName 'somenewuser' I'm wondering if there's another way I can ...
5
votes
2answers
50 views

Opinion on performance increase of a robot

Background A prototype of a firefighting robot has been done recently based on an Arduino microcontroller. It has two servos, one laser LED and 2WD motors. The desktop application is done in C# to ...
-2
votes
0answers
18 views

c# How to fetch data from database and display it on textbox AUTOMATICALLY [on hold]

So the code below works but I use a button, and I have to press the button everytime to fetch information. Does anyone have any advice on what should I do to automatically fetch information from ...
5
votes
1answer
49 views

Recursive directory copy program

A little while ago, I had to write a little C# application to recover my HDD data (full context on this question) To answer my problem I developed a console application which job was to recursively ...
2
votes
1answer
48 views

Guidence on the use of Ninject as IoC Container in a WinForms MVC Application

I am a relatively experienced WPF developer who has had good exposure to MVVM. I have been developing legacy WinForms applications for a while and have recently been asked to fully re-write a large ...
-2
votes
0answers
27 views

Static classes / methods are getting bigger, is this a code smell? [on hold]

Recently I've observed that static classes/methods have been getting updated continuously to support more features (agree, already breaking Open-closed principle). Initially when it was started the ...
2
votes
0answers
35 views

Uploading .dll files to a local computer

I have created a simple application that has grown a little bit. Though most likely it won't grow anymore, I have looked back and I realized that it has become a little monster in terms of how many ...
-1
votes
0answers
21 views
2
votes
1answer
32 views

Processor that would process an Object (say a message you received)

Sorry for being a little abstract but I have attempted to concoct something simple but it seems to spiral out of control. So I was thinking maybe I am taking the wrong approach. Here's what I am ...
0
votes
1answer
44 views

Create Xml to string serializer

I don't want to serialize everything. I created a custom attribute DoNotSerializeAttribute. If some property in info contain ...
7
votes
1answer
79 views

Milking a COM type library: “fun” with COM reflection

Once upon a time, there was a duck that wanted to know where and how user code was calling into the VBA standard library and Excel object model. To match the rest of its API, the poor little duck had ...
1
vote
2answers
83 views

Strategy pattern using an abstract class and an interface

I have implemented some sort of the strategy pattern using an abstract class and an interface: ...
1
vote
1answer
81 views

C# Reduce repetitive code in derived methods

i have interface with 2 functions. This interface is being inherited by an abstract class which implements just 1 of those functions the other 1 is left to be implemented by the derived classes of the ...
3
votes
1answer
60 views

Age Calculations (First Draft)

I found another user asking for an application to be written, it sounded simple enough and a good way to "work out" my C# "muscles" and try to get them into a better "shape". I really liked the idea ...
3
votes
0answers
35 views

Recursion task - optimization

I need your review and suggestions how to make this code better. I'm just learning recursion and sure that this solution is not ideal. Question: Write a function that given an input array of ...
0
votes
0answers
23 views

Tree processing for series and parallel execution

I have a tree processing application where some of the nodes are "executed" in parallel and some in series. I managed to do this but I feel that the solution looks a bit "hacked up" and can be ...
3
votes
0answers
92 views

Service-Repository pattern with IoC, NPoco micro-ORM and unit tests

I'm trying to build a Web API using best practices, based on a simple proof-of-concept using students. My goal is to build the system using: Onion Architecture to seperate concerns. ...
-1
votes
0answers
23 views

Adding a row to the bottom of a ListView box [on hold]

This code adds a row to a ListView box at the first row and scrolls down: ...
2
votes
0answers
58 views
+100

Using the A* algorithm to search a graph generated from a grid

Following on from my previous question, I finally got round to actually doing the A* search for the Graph<MapTile>. The changes to the code from the previous ...
2
votes
0answers
39 views

Visibility of abstract factory's implementation's product [migrated]

I'm implementing a factory like this: ...
5
votes
1answer
90 views

Defining what combination the user have in Poker

I'm developing a C# Poker app and I currently use the modulus and the divide operator % , / and dividing by 4 because there are 4 cards of the same type but with ...
2
votes
1answer
22 views

Unity Repository Best Practices

I am now developing a product, which will use Unity & Repositories when it comes to data management. I will demonstrate on a simple example. What we want to do, ...
-1
votes
0answers
24 views

Transform class with properties into interfaces [on hold]

I have the following base class: ...
1
vote
0answers
28 views

Update method using timer in WinForms Poker app

I have a WinForms Poker app that needs to update some stuff and im doing this by using a timer: ...
1
vote
1answer
33 views

Singleton implementation of Cache Dependency Manager

I am trying to implement a singleton CacheDependencyManager, by combining this CacheDependencyManager from Steve Greatrex with a singleton pattern from Jon Skeet (example 6). I'd really appreciate ...
1
vote
0answers
13 views

Displaying of Data in Application

I've just started creating a Menu/Order Application for the fun of it. Basically it's a program where a user can order certain products off of a menu. I am creating this in Unity3D so I don't have ...
2
votes
1answer
73 views

Poker app in C#

I am developing a poker application using C#. It is almost done, and I'm looking for improvements. One of the things I wonder is whether I should change my method that checks if the player has a ...
3
votes
0answers
59 views

Simple dictionary storing/viewing application

A TreeView on the left which just displays a list of files saved by the application. A DataGridViewon the right to display data ...
3
votes
1answer
417 views

Using Linq instead of multiple foreach loops

A project I'm working on often has lists within lists within lists etc. The original author often uses complicated linq expressions, but when adapting them I mostly get hopelessly bogged down and ...
-2
votes
0answers
42 views

How to refactor this monstrous IRC data parser? [closed]

I am participating in open source project and saw monstrous method with 1500 lines of code, full of conditions and cases. The surrounding code is full of code smells. Moster Method (No copy the ...
3
votes
1answer
126 views

Newtonsoft Json helper class

I've written the following helper class to help serializing objects to and from Json. I would appreciate some feed back on the style of the class. ...
1
vote
0answers
48 views

Select fields from a form by ID or Xpath and fill its value

I'm writing a program/tests in C# using Selenium and Chrome web driver. Everything works well, however I would like to simplify the code and make it object-oriented. I thought about extracting some ...
0
votes
0answers
30 views

Claims athorization service usage (increment 2) [on hold]

Is the following API of a claims authorization service ok, from the point of view of usability? ...
2
votes
2answers
65 views

Insert rows in the datagridview with a dictionary

I would like to improve the function below without calling twice InserisciRigaNote. Before I fill my dictionary. When I compare ...
5
votes
1answer
57 views

Object factory from interface types

I have a library that defines a bunch of ISprite interfaces, like IPieceSprite and ...
0
votes
0answers
21 views

AutoFill WinForm by Paste from an Excel Row [closed]

I tried my best to find a better way to copy a data row from Excel, and have the user paste it directly in the WinForm by a click of a button. The following function can be called from any suitable ...
4
votes
1answer
79 views

FizzBuzz without hard-coded logic checks

I'm a self-taught (on the job) programmer, always looking for ways to expand my skills. Seeing all the FizzBuzz examples with hard-coded logic checks made my head hurt, so I thought I'd try my hand at ...
1
vote
1answer
39 views

Web-service for wiki-like movie database

I'm making a web-service for an app with a (partially) crowdsourced movie database. These two functions allows users to add and remove which genres a movie is liked to, and get the log of whom have ...
3
votes
3answers
85 views

Add the first non-null item from one list to another list

Given these two methods, is it defensible that one is better than the other? In what terms? Performance? Elegance? Readability? ...
-1
votes
1answer
61 views

Singleton Service Initialization [on hold]

Is it ok to have a Singleton Service with Initialization like this? ...
3
votes
1answer
61 views

Disable and enable text boxes according to the radio button click

Below is the code of GPA calculator in c#. I am feeling like the code that I write and format are quite long. I am very thanks if anybody have an idea on how to improve the code and make it shorter ...
1
vote
0answers
52 views

Claims authorization service usage

I'm doing an AuthorizationService. I'm not sure how to do the usage interface of this service, so that it's practical and handy. It doesn't necessarily has to be an ...
2
votes
1answer
33 views

Building a simple REST service using Web API 1.0

Friends, It's been several years since I last worked with the ASP.NET Web API framework. Even then I had developed with it minimally. I have a requirement for a service that will allow for the ...
1
vote
2answers
66 views

A more efficient way of extracting a name from a string?

Here is some code that reads Active Directory to get a person's manager and parses the result for the managers name. It omits the remaining information. I was just wondering if there might be some ...
3
votes
1answer
38 views

MultiThreaded TCP Server with high CPU usage

I wrote simple C# TCP Server application and my program use a lot of cup, i was wondering anyone can review my code and would be grateful for any hints and suggestion. This is my code. ...
3
votes
1answer
60 views

Custom DataContract Serializer

...