Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c#]

C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

0
votes
0answers
4 views

Self-referenced generic parameter [on hold]

For example I have the following classes: ...
0
votes
0answers
5 views

Graph puzzle resolver

I've solved test task for job vacancy. Need your feedback about my solution. Task The image below shows the puzzle in the solved state. The puzzle consists of 10 cells. Among the cells one is empty, ...
0
votes
0answers
9 views

Mini HttpClient json post by Action parameter

This is an implementation of HttpClient Json Post by Action parameter. Logic: It is mainly convenient to pass the url and object (automatically converted to json by Json.Net), and can use ...
1
vote
0answers
32 views

C# Async/Await networking server

I made a simple async networking server and I'd like to get some input on the code, whether things can be done better and whether the code is stable (able to hold more than 1000 connections without ...
-2
votes
0answers
13 views

readbinary in datagrid view

Need to do the reading in the datagridview The model did, but I can not figure out how to make it appear in datagridview Model: ...
1
vote
1answer
13 views

CustomerIdentity class to bridge gap between internal and external CustomerIDs

Purpose This was designed to be able to seamlessly replace string SAPCustomerID and int CustomerID in parameter lists with <...
3
votes
2answers
29 views

Simple person manager console-app

The code below is for a coding challenge for a job. I have everything working as they requested, I've reviewed it myself and believe everything is good. I'm just looking to see if anyone see's ...
0
votes
1answer
30 views

Making EmployeeHistory ViewModel immutable as code analysis suggested

I want to display on a view the EmployeeHistory view model sorted by elements.assignEffDateNext and I want to instantiate and ...
-2
votes
0answers
16 views

How to optimize summarization linq query? [on hold]

Any optimizations that I can apply to that summarization? It seems to be slowing down my sql server even tho I am getting max 10 results from the query because of the ...
8
votes
3answers
537 views

XML node removal method with 5 arguments

I read somewhere that you should try to have as few method arguments as possible to make code easier to read, understand and use. I agree with this to a point but I'm not sure how I can make the ...
1
vote
1answer
41 views

Encrypt data to be send from service to service

I'm working with another company in a new application for my company. My job right now is to send on demand to the other company the data that they need, ciphering some of it. I should point out that ...
-2
votes
0answers
24 views

I'm trying to make a collection class in C# [on hold]

As a side project i'm trying to remake one of my favorite games from the old days, moria/angband. I'm doing it from scratch and in C#. In order to store the inventory I have the following classes, ...
1
vote
0answers
48 views

Async SelectMany implementation

Async SelectMany takes an enumeration (length unknown) of tasks, each of which returns another enumeration (length unknown and likely different from one another), and returns results from the second ...
1
vote
0answers
18 views

Industrial Automation App with tightly integrated classes

I have written a Windows Forms app that interfaces with a variety of equipment to automate the testing of some gas sensors. The program has four main objects, and sometimes these objects have to call ...
1
vote
0answers
51 views

Extension “With” for immutable types

(My code is basically a rewrite of https://github.com/ababik/Remute so much of the credit goes there) The idea is to use lambda expression to provide a general With...
2
votes
1answer
44 views

Query builder with OOP design

I am designing a query builder, where the user can just add conditions or groups, and each group can, in turn, have conditions in it. I came up wit the below class design. Can this design be improved? ...
-1
votes
0answers
14 views

Control Application Insight Logging [on hold]

I used TelemetryClient to sink my application logs in Azure Application Insight. Now I want to control my logging according to the environment. I tried to set ...
-2
votes
0answers
19 views

BinaryReader unicode error [on hold]

I'm trying to sort out the binaryReader in an error Unable to read after finishing the file I can not understand what the error is and why he does not read Unicode ...
3
votes
0answers
53 views

TCP client reading socket asynchronously

I'm relatively new to .Net/UWP networking and have been trying to make sense of the APIs. I'd like to implement a TCP client that is capable of reading and sending messages independently (there is no ...
-1
votes
0answers
19 views

Updated quiz code, how to imlement C# OOP classes to accomplish the same thing [on hold]

I asked for help on a C# Quiz program I am writing for my ENGR115 class in this thread: Original Question Roland replied with some good advice for me, which I followed, and came up with this revised ...
1
vote
0answers
18 views

Transparent proxy using HttpClient

I'm looking for feedback on some code I've written to work as a transparent proxy. I'm developing a web app that needs information from another web site's API, but that web site has disabled CORS and ...
2
votes
1answer
44 views

Revision: BinaryTree<T> written in C#

Since my last question (BinaryTree<T> written in C#), I have rewritten my code based on the responses. My project can be found on my GitHub repo here; ...
-2
votes
0answers
40 views

Im teaching c# arrays is this a good tutorial? [migrated]

So I am jumping in for a teacher next week and my job is to teach them about arrays in c#. They know variables, int, string, double and how to output data. I tried to build this so it would be ...
5
votes
1answer
78 views

Building a bool expressions validator

I'm writing a system that's responsible for changing Status of Order. There's a specific set of rules that define route of changing ...
-1
votes
0answers
17 views

Entity Framework Core - Dynamic Relationship Builder [on hold]

So I have a relatively large database that is defined with code first principles in Entity Framework Core. I had quite a few lines of relationships within my context file. So I went ahead and wrote a ...
0
votes
1answer
55 views

Checking For multiple null references [on hold]

So this question might be a bit opinion based but I am a bit confused, say i have these two code snippets - ...
-1
votes
0answers
32 views

is there a better way to test this class? [on hold]

Recently, I am learning unit test and try to use this skill in my project. However, I have some question about how to test following code. ...
1
vote
0answers
26 views

Helper class for ASP.net to return data from SQL server

My goal is to create a class that I can call from my webpages like this. Similar to a data access layer? ...
2
votes
1answer
57 views

AVL height-balanced binary search Tree and Dictionary

Mostly as a learning exercise, and partly as I thought it might be useful, I have written an implementation of AVL trees ( https://en.wikipedia.org/wiki/AVL_tree ). An AVL tree is a height-balanced ...
0
votes
0answers
21 views

WPF Async Filter [on hold]

I'm using a SearchWaterMArkTextBox and a Gridview, where I've bind this line to my gridview. ...
11
votes
2answers
2k views

BinaryTree<T> written in C#

I've written a binary-tree using .NET Core 3.0. What can I do to improve my coding style? ...
-2
votes
0answers
28 views

Order Integers From Ascending as Well As Descending Order [closed]

I am working through a worksheet of for loops in c# and have come across this problem, "Write a program to request an integer n from 1 to 9 and print a line of output consisting of ascending digits ...
-1
votes
0answers
45 views

Bulk insert of employees into Oracle database [on hold]

I have data that is stored in a list of class Employee: ...
0
votes
0answers
16 views

Extension to BindingList<T> that allows for cancelable notifications of changing and deleting

This is an extension of the System.ComponentModel.BindingList<T> class that allows for notifications of item changing and deleting. These notifications ...
2
votes
1answer
61 views

Write a function that adds two numbers stored in a linked list and returns the sum

Just for fun I did the following exercise from "Cracking the coding interview. 4th edition": You have two numbers represented by a linked list, where each node contains a single digit. The digits ...
2
votes
1answer
40 views

Upload a file asynchronously

I need your opinion about my practice. I want to improve it. The requirements are the following: RESTFUL + OWIN (SelfHosted) Endpoint - Upload a file asynchronously Make a request to the endpoint ...
4
votes
2answers
73 views

Switch-Case pattern for non-constant types (part 2)

You can find the "part 1" here. 1. Objectives The main goal of this post is to build a switch-like structure, which allows to use non-constant Type (e.g. Type, <...
4
votes
1answer
108 views

Quiz program that asks 10 questions, repeats incorrectly answered ones a second time, gives results at end

I'm currently attending ERAU (online), and in my Computing for Engineers class we are learning C#. An ongoing project throughout the class is to build a "quiz" program that asks 10 questions, in order,...
-2
votes
0answers
25 views

Is there any difference of creating varibale inside using statement vs outside using? [closed]

For example I have some IDisposable object. For it I'm using using statement. Is there any difference between creating variable (...
0
votes
0answers
52 views

Aggregate sensor readings from multiple sources

I've developed a toy example to investigate how async works in C#. Though I've learned a lot this week, I'm still unsure of the finer details, as this is my first C#...
2
votes
1answer
93 views

Safely Initialising a static variable to a file [on hold]

This might appear to be a trivial task, but I think it's not the case. My code originally looked like this: ...
0
votes
2answers
115 views

Switch-Case pattern for non-constant types [closed]

Edit: Following answers, I modified my code, and wrote an other question. History Recently, I (stupidly) tried to make a switch on myObj.GetType(). Of course, it ...
0
votes
1answer
46 views

Enforcing C# Task to exist only once at any given point of time for a given ID

There were multiple times in different applications that I needed to accomplish the following behavior with C# Task and I did it in a certain way, and would like to ...
11
votes
2answers
203 views
+100

Traversing an infinite graph using Dijkstra's algorithm to maximize cookie production speed

Imagine the following situation: It is the year 20XX. You are a prodigious baker, capable of baking cookies at an astonishing rate of 1 cookie per second. Your archnemesis, an equally excellent baker,...
3
votes
0answers
27 views

Generic object-to-XML mapper

This code is part of a larger mapping library I'm working on to address some business concerns of transforming data. I was inspired by mapstruct in Java, but opted for users to annotate / add ...
6
votes
1answer
500 views

TCP client and server API

Hello I made a server and client API for TCP connection. It is intended to shorten the work you need to do to prepare the server and client. It's separeted in 3 projects - ...
3
votes
1answer
114 views

Sanity check for Simple Threading library

I've created a library providing a ThreadBlock that has the following features: Aggregates results of all actions executed Provides for non-threaded warm up to ...
3
votes
1answer
140 views

Logging inside a Linq fluent chain [closed]

I've posted this to Stack Overflow, but someone voted to close as they felt it was opinion based, so I'm bringing it over to Code Review. I have some Linq fluent chains to shape an original ...
4
votes
0answers
153 views

The process to calculate the Levenshtien distance of each element of a large data set with every other element of another larger data set

I am currently working on a problem to find the best matches of data in a List namely "ListA" from another List called "ListB". Whenever I find a match of an element for "ListA" with any element in "...
5
votes
1answer
233 views

Count pairs in list of integers such that their addition is equal to the input value

Given a List<int>, the problem I am trying to solve is: Find the number of unique pairs in List<int> such that their ...