Stack Exchange Network

Stack Exchange network consists of 175 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.

0
votes
0answers
5 views

Simplified light Serialize/Deserialize to/from JSON for .NET

Just a very simplified and stright-forward way of serialize/deserialize to/from JSON using standard .NET 4+ libs. I was trying to avoid "complexity", so get rid of 3rd part libs and heavy-...
1
vote
1answer
49 views

Assigning values to array elements based on a look up table

HI i am writing a c# program where i need to populate a array based on a look up table and set of string arrays with metadata. My lookup table looks like this (Table with key: transmitter, value: ...
-2
votes
0answers
36 views

Limit concurrent calls per period in C#

I have an external API which is rate limited, so I can call it only 50 times per second with the same auth token. I have many auth tokens, so I need throttling per auth token, which will not allow me ...
1
vote
1answer
34 views

Encrypts using AES with random initialization vector meant for data with limited visibility and then long rest

I've done some research, reviewed countless SO questions that appeared similar, leading me to endless rabbit holes. My solution is working, but I don't like it. I want to create a random IV for AES ...
2
votes
0answers
15 views

/Proc/net/tcp results Converter/Editor

Being unable to easily read the output of /proc/net/tcp I made a small C# console app that modifies the output to be in decimal notation instead of the standard hexadecimal, show the corresponding ...
1
vote
0answers
30 views

Querying connection string across solution [closed]

I have an app.config file that contains some connection strings, this is accessed on a project-by-project basis In my solution, I have the following projects: A B ...
1
vote
1answer
85 views

IEnumerable<T> async serialization

I am building some classes to serialize (in an async / await way) potentially pretty long ...
3
votes
1answer
39 views
0
votes
0answers
19 views

C# Get Email With Attachments Older than one year [migrated]

Now I use c# with .net3.5. I try to get mails with attachments with this piece of code: ...
1
vote
0answers
74 views

An arithmetic operation app in C#

One of my friends was creating an app with following requirements and having been someone with slightly more coding experience, I wanted to help: Create a calculator that does one arithmetic ...
4
votes
1answer
110 views

In-Memory database supporting transactions

I referred to the post here but it does not address the question that I have with regards to my implementation. I have a C# implementation of an in-memory database that I came up with during a recent ...
1
vote
2answers
100 views

C# Poker Game: Refactor method to evaluate poker hands

Preface: I've perused the other related questions before creating this one but I believe that those solutions weren't applicable to my situation. I'll concede that its possible that I may not have ...
2
votes
2answers
76 views

Generic Singly-Linked List implementation

I'm looking for some feedback regarding my implementation of a generic singly-linked list in C#. I'm also looking for some tips on how to implement other techniques such as using ...
1
vote
0answers
43 views

SemaphoreSlim extension method for safely handling cancellation and disposal

I have often found myself using a try {semaphore.Wait()} finally {semaphore.Release()} pattern when using semaphores, so decided I wanted to try and write an ...
3
votes
2answers
140 views

Implement Immutable Collection in C#

I would like to define some constant sequences (of bytes, specifically) in my C# library/API. Both length and content should not vary, preferably by any means (barring reflection). To this end, a <...
5
votes
1answer
60 views

Non-Entity framework database interaction model

A C# WPF user interface has been developed for the Book Inventory MySQL database previously shown in this question. Since the database had already been developed this was a database first ...
7
votes
5answers
604 views

Find the next monthly expiration date

I have an agreement with a customer. When the agreement ends, the customer needs to pay. The amount which the customer needs to pay increases for each month that has passed since the agreement was ...
3
votes
0answers
115 views

Deserializing JSON with Utf8JsonReader

Path of Exile is a PC game where players can list their items for sale. The game has a public API that serves JSON which contains all of these items. My application consumes that JSON and indexes the ...
-1
votes
1answer
83 views

Handling Entity Framework in connected mode within Windows Forms [closed]

I know the difference between the Entity Framework connected mode vs disconnected mode. In connected mode we do all the stuff inside one single DbContext instance. ...
2
votes
1answer
53 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; ...
4
votes
1answer
55 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
56 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
56 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
37 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
45 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
53 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
33 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
178 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....
5
votes
2answers
859 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
230 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
57 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
90 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
834 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
143 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
109 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
113 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
58 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
814 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
579 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
612 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
64 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
93 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
111 views

Concurrent usage of resources

Please take a look at the following code. This is my attempt at understanding concurrent applications. ...
4
votes
1answer
104 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
431 views

WebAPI global exception handler

There is a global exception handler in our WebAPI application that looks like the following: ...
-1
votes
1answer
189 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
99 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 ...