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 [.net]

.NET is a software framework supporting a multi-language paradigm and supporting language interoperability. .NET applications are executed in a virtual machine (CLR) which provides a few important services: security, memory management and exception handling.

-4
votes
0answers
14 views

Creating 45 variables and properties for CRUD program [on hold]

I'm new in OOP world, I've been using functional paradigm in vb past 5 years and I have a task to link a vb form to a table which has got 45 fields. It's a Form with Textbox, comboxbox, richtextbox......
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; ...
3
votes
0answers
29 views

Analyzing spoke overlaps during rotation: Round 2

Round 1: Analyzing spoke overlaps during rotation I previously posted this question, but I've changed a lot of the code since then. There was a mention of the previous being a bit mixed up, and ...
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? ...
6
votes
1answer
45 views

Analyzing spoke overlaps during rotation

For a personal project that I've recently started I have to analyze the rotation of two shapes with sets of spokes, where the spokes are evenly-spaced, and split into a given number. That is, if I ...
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#...
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 ...
0
votes
0answers
34 views

Using an N-Tier architecture for a dynamic CRUD user control system

I want to design a flexible dynamic system for a client with standard data-entry screens and CRUD UserControls I dont know whether ...
1
vote
1answer
45 views

Repository to update flights

I have the Repository below, but I have noticed that there is a recurrent pattern try / catch which does not seem to be that ...
1
vote
0answers
26 views

Iterating over combinations

Background The following describes the real world problem that my code is intended to solve. It is may help you understand what the code is doing and why. I don't think this is strictly necessary in ...
0
votes
1answer
94 views

Convert IEnumerable to HTML table string

My code can generate HTML table strings well, but it depends on JSON.NET. I'm converting IEnumerable to an HTML table string using Json.NET but I think I shouldn't....
4
votes
2answers
851 views

Going from IQueryable<IEnumerable<myObj>> to IEnumerable<myObj>

I have a "GetPersonsPerDepartment()" method returning a IQueryable<IEnumerable<Person>> while I'm trying to get a simple ...
5
votes
2answers
181 views

Generic extension to transform a flat nested list to hierarchy list

I have a collection of items in my database with a ParentId property. I'm reading the categories as a flat structure and I would like to convert it to a hierarchy list by populating the ParentCategory ...
1
vote
1answer
55 views

Set / verify password using REST API

I have limited experience with both making REST APIs and implementing security features, so I figured it'd be worth running this code through some other people's eyes before making it live. My main ...
0
votes
3answers
76 views

App that sets configuration data

I've been writing my code like this for a really long time now, I am wondering if there is a more efficient way to do this. This is especially after a senior developer said my code was very amateurish....
1
vote
2answers
79 views

Retrieve generic contract names for Managed Extensibility Framework

Edit Found the original contract name resolution by .NET MEF, the code below is not useful anymore. See response! My issue was to use existing code, to make a MEF ...
16
votes
2answers
824 views

Enforcing string validity with the C# type system

One of my biggest complaints about .NET is that there's no way to guarantee a string match a certain type in the type-system. Note This started as more of a proof-of-concept than a real usable ...
1
vote
0answers
104 views

Convert video to GIF using ffMPEG

Looking for the best way to speed up or maybe move from FFMpegConverter to another application for converting video to GIF, because it takes much time, will be much ...
4
votes
3answers
107 views

Really easy synchronised access to an IEnumerable without boilerplate code

Often when reading data from a sequence (IEnumerable<T>) in multi-threaded code, a consistent snapshot needs to be taken inside a ...
5
votes
1answer
100 views

Specialized ConcurrentLinkedList

I need a concurrent data structure with the following properties: Low overhead for enumeration Insert only at end. Removal from any point. Enumeration should be safe with concurrent writing ...
0
votes
2answers
52 views

search a given word in word file by Aspose

I implemented a function to check a MS Word document is contain a given word or not. The function will return true if filePath is contain word. Otherwise it will return false. This is my solution ...
7
votes
2answers
553 views

Generic Dictionary Equality Comparer

I created the below comparer to allow me to use a generic dictionary as a key to another generic dictionary. My GetHashCode implementation creates a hash based on ...
-2
votes
1answer
32 views

Add new TabItem to a TabControl using Click Event [closed]

I'm trying to add a new TabItem to a TabControl. The TabItem's content will be set to a new Frame, and the frame holds the actual Page. A new Tabitem is added each time the button is clicked, this is ...
1
vote
1answer
226 views

JSON serialization object with huge IEnumerable

This code is looping over polygons geometries vertices in order to create a list of deltas (distance) between vertices coordinates to compact the geometry before sending it into the web. Geometry ...
1
vote
2answers
362 views

Luhn Algorithm “modulus 10” checksum

I wanted to challenge myself in a new language that I am learning (C#) by doing a simple exercise: check if a "modulus 10" Luhn number is valid or not. In this case the common application if verifying ...
3
votes
1answer
57 views

Determining if there is data left after fetching a page of data

I just faced a problem where I needed to know if extra data was present in a given collection after a Take operation took place. Specifically, this is related to ...
5
votes
2answers
90 views

Encoding and decoding log entries in a Lossy Binary Format

One of the projects I'm working on requires logging a huge amount of information (basically, every function call). The problem is obviously that logging a lot of information has a few side-effects, ...
1
vote
1answer
108 views

Concurrent usage of resources

Please take a look at the following code. This is my attempt at understanding concurrent applications. ...
4
votes
1answer
88 views

WiktionaryBot — A Discord bot for generating Wiktionary links quickly

I'm an active contributing member of Wiktionary and an active member of an active Wiktionary Discord server. Some time ago, several users proposed a bot which would make linking to Wiktionary in ...
2
votes
1answer
239 views

WebAPI global exception handler

There is a global exception handler in our WebAPI application that looks like the following: ...
-1
votes
1answer
168 views

Creating a Compatibility Shim for ExampleClass to be targeted both to .net framework and .net core 2.0

Intro: Before showing the actual code for review, let me show you an ExampleClass to create a shim for. ...
-3
votes
1answer
94 views

Best Practice .Contains C# [closed]

I don't quite know where to post this but C# is not my first language and I am hoping to get someone to nod their head or correct me :) This works but seems counter intuitive - mostly because I ...
4
votes
0answers
214 views

Custom TaskScheduler: Limited concurrency level

I'm interested in some feedback for a custom TaskScheduler implementation I wrote today for use on a game server - I wanted to be able to have a single-threaded scheduler for tasks since the game is ...
4
votes
2answers
361 views

ForEachAsync extension method (a way to run an async operation on each item of a sequence in parallel)

In a recent project I worked on we faced some issues due to an excess of parallelization (thousands of threads were created and the overall result was a degradation of performance and several spikes ...
7
votes
2answers
497 views

Palindrome program needs improvement

Here a string is taken as input and the program suppose to check whether the string is palindrome or not. Is there any way the code can be improved? Is it okay to use foreach to break the string into ...
1
vote
0answers
39 views

Simple json config provider

I'm pretty new to this so constructive criticism is acceptable. I'm trying to find any way I can improve this system, all it does is take a string, determine if that string is a web address or a file ...
1
vote
0answers
301 views

Secure password hashing implementation with salt and pepper

I share below my password hashing implementation with salt and pepper in C#, for your review and feedback. In my implementation methods like ValidatePassword(), ChangePassword() are in the user class. ...
1
vote
1answer
275 views

ChangeCalculator for calculating money denominations in change

I'm doing some exercises in OOP and I just created a program that calculates amounts of denominations in a change at the shop. So, let's say something costs 10, I give 25.30 (for some reason), so I ...
-1
votes
1answer
27 views

AppTaskWorker - Running class methods at sporadic intervals

I decided to write a class to do this for me. I had a lot of methods that needed to be invoked at sporadic intervals, across multiple projects. The dictionary will eventually be class methods, I ...
7
votes
3answers
502 views

Method for returning valid URLs from a sitemap URL

I need a method which fetches all of the text from a URL (generally a sitemap URL), and returns an IEnumerable of all valid URLs contained in the text returned from ...
0
votes
1answer
87 views

Mechanism to retry failed requests, with throttling

I have a simple event that the client sends to the server, the server can then respond saying if it was successful, or if it failed for some reason. The client has to send a auth code, which is ...
4
votes
2answers
141 views

EnumerableHelpers: a partial implementation of LINQ for .NET Framework 2.0

Here is a static class with some helper methods for some common LINQ operations on enumerables, built against .NET Framework 2.0. This class is part of the xofz.Core98 library. Edit: a full review ...
1
vote
2answers
266 views

Creating an instance of an unit of work (NHibernate)

I'm trying to figure out how to create a NHibernate UnitOfWork using .NET Core Dependency Injection. I was just hard-coding the ...
4
votes
0answers
132 views

Comparing two instances of a class

I have a Calculation class. It is persisted in the DB and users can modify it. The aim of the CompareWith function is to ...
3
votes
1answer
49 views

Registering an event participant, using Entity Framework and several associated models

I have a method that is responsible for receiving an object and perform the information saved with Entity Framwork, using the Repository pattern. The issue is that this object is, basically, a DTO. ...
2
votes
0answers
103 views

Server app: pinging up to 500 clients asynchronyosly

TCP/IP server which controls up to 500 clients. There's a list of added computers and the server gets this list, selects computers which are not already connected and ping them using host name. ...
3
votes
1answer
67 views

Replace a^b by Pow(a,b)

The application uses NCalc to execute diverse calculations. The 'natural' way to write powers using a computer is using the ^ symbol. However, NCalc already uses ...
6
votes
3answers
1k views

C# version of C++ shared_ptr

I need something akin to C++'s shared_ptr. Essentially I need an IDisposable item that I can ensure is cleaned up as soon as possible once all references have been removed, but this resource will be ...
0
votes
1answer
393 views

Mocking objects using abstract factory

For some time I am trying to make a mocking library for C# that mocks objects with just 1 line of code. I am using abstract factory pattern to know what is the object's type so that I can work with ...
0
votes
2answers
159 views

Add item at the beginning of each inner array in jagged array

So, there is a big jagged string array (~ [120] [1 000 000]) here that represents data from an excel worksheet ( columns / rows). Task: We have to append items at the beginning of each inner array. ...