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

1
vote
0answers
12 views

Processor that would process an Object (say a message you received) [on hold]

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
28 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 ...
6
votes
0answers
37 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 ...
0
votes
2answers
48 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
56 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
43 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 ...
2
votes
0answers
25 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
19 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
70 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
19 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: ...
0
votes
0answers
24 views

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
79 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 ...
1
vote
0answers
12 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
20 views

Transform class with properties into interfaces [on hold]

I have the following base class: ...
1
vote
0answers
23 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
26 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
11 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
68 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
54 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
408 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
41 views

How to refactor this monstrous IRC data parser? [on hold]

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
123 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
46 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
64 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
19 views

AutoFill WinForm by Paste from an Excel Row [on hold]

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
36 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
84 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
58 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
32 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
36 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
56 views

Custom DataContract Serializer

...
0
votes
2answers
86 views

Can this be written in a shorter way? Dynamic function call perhaps?

Below you'll find my switch case. My question is, for each function I am manually adding another case. Can this be somehow shortened? You see case names and function names are same. For example case ...
3
votes
1answer
95 views

Joining huge CSV files and splitting the result into batches

I've got ~20GB of data about the same subject, concatenated from small files of 16kB, each produced by different measurement equipment. They share some headers (on the example: B, D & E) and they ...
5
votes
1answer
26 views

Parallel extension enchancement

As suggested in comments here I created a new topic for next version. I edited a bit original code, added exception processing and optimization, that first N = 1/core count tasks are processed on main ...
4
votes
1answer
52 views

File creation program

I have written a program that is very simple, with a very specific purpose. However, having written it in approximately 2 hours, (with a bit of cut/paste from some of my other programs and MSDN) it's ...
4
votes
1answer
80 views

Testing an abstract class

I started writing a set of tests for my SageContextBase class, which needs to be abstract because the client code must derive ...
1
vote
0answers
26 views

Create MD5 hash list of big memory mapped files

So I wrote this class: ...
1
vote
1answer
47 views

Multithreading extensions

I created a following class to manage multithreading without extra overhead, which exist when I use Parallel TPL class. It is also useful for systems without ...
0
votes
0answers
11 views

EventProcessor code to pass events to dedicated EventHandlers

I am trying to find a neat way to pass incoming events to dedicated event handlers. I would appreciate any improvement suggestions regarding the code below. ...
2
votes
1answer
42 views

2D Unity game using 3D objects, gather points and avoid obstacles

I've been messing around with some stuff in Unity and are now working with 5 classes in my project. As I am very new to the engine, and even C#, I believe I made a rather messy code, even though it ...
1
vote
1answer
30 views

Create “refresh token” action filter

I am using idenity server 3 authentication. I have to implement refresh token logic. AccessTokenLifetime is 1 hour, and after that time I want to update access token with refresh token. I want do ...
3
votes
1answer
33 views

Use Page Object Model in Selenium tests?

I am very new to selenium, and for my current project, I had the task of creating the automated test scripts for our website. I am the only one on my team who had any experience with Selenium, but not ...
-5
votes
0answers
26 views

How can call both :this() and :base() in this specific case? [closed]

I have a base class EntityModel (it needs to work with a database) ...