C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.
1
vote
0answers
9 views
Interprocess CancellationToken
I have a situation where I have a program will start up another program and it will do some work. I need to be able to stop this work if certain conditions arise. I want to use a CancellationToken ...
3
votes
1answer
12 views
Custom collection implementing IList<T> saving current, next and previous element
I'm developing a Tic Tac Toe game where you can change your pawn look
Now as You can see it has 2 buttons one for next one for previous, and You can also pick if you want to edit the O or the X ...
3
votes
1answer
14 views
CSV concatenator
I have the following code (running in LINQPad) which takes tens of thousands of CSV files and concatenates them to create a single file.
Each CSV file has two lines: a header line and a data line. I ...
0
votes
1answer
42 views
CRUD code for a finance WebForm
I have a finance web-application in ASP.NET WebForms using Telerik RAD controls. Two event handlers wound up being very similar in implementation.
What steps could I take to improve the organization ...
-2
votes
0answers
21 views
Adding additional data to buniess model [on hold]
I have problem with extending classes used business logic and pass them to another systems. For instance I have RetailOrder class that is model for order processing classes. It holds ids of articles, ...
2
votes
0answers
28 views
Interop between C++ and C# via C++/CLI with callbacks
I want to use an existing C++ library in a C# app. The C++ library will have async callbacks for things like OnConnect and user updates so I want to reflect this in ...
2
votes
1answer
49 views
Create Database Connection and run the Insert,Delete,Update queries Class in C#
Recently while developing our demo project I had to a write a lot of repetitive code for executing the database queries(Insert,Update,Delete). So, I have put all the repetitive code into a class ...
1
vote
1answer
43 views
How to decrease execution time of web scraper [on hold]
I've made a simple app in c# which is using HtmlAgilityPack to scrape content by xPath. I am just parsing site and extracting ...
0
votes
0answers
22 views
Multiple threads cannot be in Waithandle state for more time gives error of high cpu usage [on hold]
Below is a program of hex data sent through 3 ports where i am using thread for sending continuous data in while loop .But it gets stopped after few hours with error arising as Thread should not be in ...
3
votes
2answers
67 views
Multi threading with webrequests/responses
I have been working with multi threading and would like some feedback on the code, i generally suck at class design/OO which i am trying to improve. Im sure there is a better way of making it neater ...
0
votes
0answers
29 views
Generic Polling Class and Using it to Poll SqlConnection
I have the following poller class that can be used to "poll the required action":
...
-4
votes
1answer
40 views
EntityFramework code-first - right place for entity “import” function [on hold]
I have an EF-driven Repository pattern implementation. Roughly looks like this:
...
0
votes
0answers
36 views
Script Task to read complex Excel file structure with multiple sheets and export into database tables
Currently working in SSIS 2012 - Script Task to read complex Excel file structure with multiple sheets and export into database tables. Below is my sample code which does below process.
Get the ...
12
votes
1answer
45 views
Shared VB6 *and* VBA extensibility add-in with OnConnect and OnDisconnect handling
Rubberduck works well enough when the VBE is of the VBA variety, but it currently only works when the Rubberduck is configured to load at VBA start-up, and it has a tendency to crash the host ...
12
votes
1answer
95 views
Rainfall Challenge (August 2016 Community Challenge)
My solution for the Rainfall Challenge (August 2016 Community Challenge).
Error handling was intentionally ignored.
Cell.cs
...
-7
votes
0answers
28 views
Below code multiple thread use causes clr error and unhandled .Net memory exception [on hold]
I have written a program to send hex data continuously through 3 serial ports.But after working for 8-9 hours sending data using debug diagnostic tool got error as kernalbas.dll raised exception and ...
2
votes
2answers
64 views
Repository Pattern with Dapper + Unity
I just finished the Pluralsight courses about Inversion of Control and Mirco-ORMs, and I am struggling with the implementation aspect of some of the concepts.
This is my (simplified) repository ...
7
votes
1answer
90 views
Multithreaded Decompression
I'm working on optimizing a class for decompressing Mass Effect 3's .sfar files. .sfar files are archives, and this function decompresses a file from inside an .sfar and writes it to the provided ...
5
votes
3answers
83 views
Building a custom response body based on API consumer's need
I've been researching ways to reduce response size on requests in my rest API without adding lots of calls to get back just the ID and single properties. What I've ended up attempting is creating the ...
9
votes
2answers
390 views
Responding to API requests with much complexity
So having used the SE API multiple times, I like how all responses are in a Wrapper object, and for my own API design I figured it was a good method to follow.
Of ...
-10
votes
0answers
34 views
C#: Parser Error - Unexpected symbol “in” of foreach loop [on hold]
I am new with c# and I've been working on a simple program but seems there is something wrong that causes a "Parser Error" keeps showing up. I don't understand the error. Any help?
2
votes
1answer
122 views
Tic Tac Toe (Decoupling patterns and component based design)
I'm learning unity with c# programming and trying to learn game design. I know the that the best way to learn games programming is recreate some of the existing games. This is my code to create Tic ...
0
votes
1answer
34 views
Controller method to modify Active Directory, other systems, and send notification with error handling
I have to handle an Action (Modify) about my web application.
The app working with SMTP Email, ActiveDirectory, External System (...
1
vote
2answers
62 views
Webdriver-based test that uses configuration parameters from a database [on hold]
I am writing automated functional tests for my application. To interact with the application, I use the SQL database to retrieve data and validate data.
One of the challenges that I'm facing is that ...
-2
votes
0answers
45 views
Pong game scoring system C# [on hold]
I am currently making a simple pong game in Unity2D, following this tutorial. I currently have a scene where there is a title, and a game board. I want to add a scoring system so that when each player ...
2
votes
0answers
59 views
Solving the Mining algorithm from HackerRank
I was working on this problem for a few hours last night and finally came up with a brute-force solution. The task is to report the minimum work necessary (sum of weight × distance) to relocate gold ...
5
votes
3answers
67 views
Statistical Analysis of X-Wing Game Dice
I was in a discussion about mechanics of the X-Wing miniatures game where we were discussing a couple of the ways to improve attacks and I put together this small C# console application to determine ...
6
votes
2answers
319 views
First simple multithreaded application
It's been quite some time since I got my eye on the multi-threading, today I decided to create a really simple application which runs 2 while loops simultaneously and prints the current progress of ...
4
votes
1answer
73 views
Replace EOL in stream
I need to replace the windows EOL "\r\n" with just "\n", and I want to this in the fastest way possible, as the software will have a lot of files to upload, many of them with a few thousands lines. ...
9
votes
1answer
71 views
Fighting f̶i̶r̶e̶ regex with f̶i̶r̶e̶ regex
So someone requested a Regex Builder / Assistant for Rubberduck and since my CS class had been covering the topic only recently I was thinking to myself: "This sounds interesting, you should do this".
...
2
votes
2answers
121 views
8
votes
3answers
88 views
Html rendering framework with dynamics
I came to the conclusion that the previous framework was too complicated and not easily extendable so I tried it again but this time with dynamics.
It's much much shorter and I think it's much easier ...
1
vote
2answers
43 views
ASP.NET WebAPI `In` Validation Attribute
I've created custom validation attribute that will be used to validate model. It allows me to specify values that are valid for specific field.
Here is my code:
...
1
vote
2answers
65 views
Code Behind to manage AD users for a CRM system
I have big class in ASP.NET WebForms (legacy). I use VS 2012.
I want to evaluate Conditions and execute Actions - Commands like:
Create in AD
Delete in AD
Enable in CRM
DesEnable ...
4
votes
1answer
46 views
Add entities to and execute “ExecuteMultipleRequest”
I have a method which takes a list of Entity objects, loop through elements in that list and add them to a "ExecuteMultipleRequest" object. After that the ExecuteMultipleRequest will be executed.
...
3
votes
0answers
40 views
Making recurring requests to a web service using Task.Run
I am practicing with using Tasks and I put something together but am unsure if I used it properly. I read through Stephen Cleary's blog and it seems that it is okay but at the same time I do some ...
2
votes
1answer
71 views
WPF object model control with singleton and static messenger? ConditionalWeakTable?
As always first I have to say that I'm an amateur and not native English speaker, so please have a little patience if I write nonsense ;)
I've worked as an accountant for more than 10 years and since ...
0
votes
0answers
25 views
Converting someone's age into leap days [closed]
So I'm trying to create a simple console app that will determine the users age in days, hours, minutes and seconds and was able to get all 4 done, but I was wondering if there was any to use TimeSpan ...
9
votes
1answer
98 views
CodeKata: Find all the runs in the set
Given a finite set of unique numbers, find all the runs in the set. Runs are 1 or more consecutive numbers.
That is, given {1,59,12,43,4,58,5,13,46,3,6}, the output should be: {1}, {3,4,5,6}, {12,13},...
6
votes
0answers
45 views
Html rendering framework for emails
Sometimes I need to auto-generate html-emails. To make this task a little bit easier I created a simple framework that takes care of renderinghtml. Because I'm mainly interested in generating html for ...
2
votes
5answers
331 views
Reading event logs and acting when specific event is not present
I have a small application which is basically a FileSystemWatcher which performs some operations when a file is updated.
What I need it to do is query the event ...
6
votes
3answers
185 views
Searching files in a directory for a string
I have the following static class that enumerates directories in a folder, then searches each file in the folder (it seems to only work with text files even thought I don't explicitly specify that) ...
3
votes
0answers
20 views
ViewModel base class supporting property notification, error notification and property value history
I've created a general purpose ViewModel base class in what I believe it's purest
behaviour. It features property notification, error notification and property value history. Please take a look at it ...
4
votes
0answers
45 views
H.264 image encoding using Media Foundation .NET
We have some video analysis software written in c# .NET that uses OpenCV via the Emgu.CV wrappers. The video frames come from a GiGEVision camera (not a normal capture device) which are then analysed, ...
4
votes
1answer
42 views
0
votes
0answers
21 views
Displaying picture collections from a user's picture library
Currently, I have been digging up my old codes. One of the applications I worked on was an Image editing phone app that displays a collection of random pictures from a user's picture, which I limited ...
4
votes
2answers
70 views
Passing variable to BackgroundWorker and use the same value later
I create multiple BackgroundWorker within a for-loop and each of them needs to know a special value. To simplify, it is just <...
2
votes
1answer
19 views
Verify if user has at least one of required roles to be able to update a record owned by a certain user
I have a Microsoft CRM 2016 plugin that checks if the user that triggers an update message has at least one of the required roles, when the updated record is owned by a specific user.
Here's the code:...
5
votes
2answers
47 views
ListBox with a dynamic number of TextBox elements
I am making a kind of form, and I want the user to be able to enter a dynamic number of string inputs. The idea is that a single TextBox will be displayed, and once ...
7
votes
2answers
82 views
Get host ip address behind load balancer or without lb
Description
Aplication type: WEB API
.NET Framework: 4.5
MVC: 5
I need caller host ip in my custom action filter and then in action. On some enviroments we have configured load balancer which ...