A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [c#]

C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform. Use this tag for questions related to C#. In case a specific version of the framework is used, you could also include that tag; for instance .net-2.0.

495 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
146 views

WebAPI: Async Filtering CSV content + Json/XML Serialization

I am coding a csv file filtering api in ASP.NET Core, which takes a csv file located at a given uri (and retrieved via the query string) convert the content to a collection of records, then apply a ...
2
votes
0answers
61 views

Iterating in a list of data and search data in another datatable

I have a list which has 25000 data and I am iterating in all data and in each iteration, I am searching data in another data table. my whole routine is taking a long time to finish. Loading data from ...
2
votes
0answers
91 views

Web API CRUD Demo with Console App and MVC Web Application

I have created a simple CRUD method using Web API project which consumed by 2 platform: Console App and MVC Web Application. The EntityModel project is mainly the entity and the DAL layer. Is my ...
2
votes
0answers
65 views

Generic DialogueBox class with different parameters

I have implemented a DialogueBox class which can be static, singleton, service locator, etc. I have written it as a singleton pattern and implemented it in Unity3d engine. It is a part of a game. I ...
2
votes
0answers
49 views

VSTO add-in for Excel to solve systems of linear equations

This code is part of a VSTO add-in for Excel. As the title states it solves systems of linear equations by allowing the user to select the appropriate ranges. The code works and covers most issues I ...
2
votes
0answers
2k views

Using Entity Framework to Call an Oracle Stored Procedure with Multiple Cursors

I wrote the following code to use Entity Framework 6 and Managed Oracle Providers to call an Oracle stored procedure that returns multiple cursors. Would like some input about the code I used to ...
2
votes
0answers
89 views

Conditional AsyncLock implementation

I have a case where I match data from DB by the various filters. Until the match is updated in the DB, I don't want to accept requests for matching with the same criteria, as this could produce ...
2
votes
0answers
49 views

Monadic implementation of asynchronous tasks (hidden overhead of threads)

So, I've been reading about monads and I wanted to see if I could implement a system for asynchronous computation in a monadic way. I came up with two solutions: The first one spawns a thread for ...
2
votes
0answers
227 views

Unity Generic Pool System

So i'm using this for pooling my gameObjects in game. Every other script can ask for a pooled GameObject using ...
2
votes
0answers
52 views

Task based GameObject recorder for networked game

I've recently been dipping my toes in to async code so I'm not 100% sure if there's a better way to do this, or if I'm going to run into problems down the road. I plan on using the following class in ...
2
votes
0answers
55 views

XML graphing, and attribute existence

I have been working on my own form of validation for XML other then xpath, as a toy project. First off, I use this class to add Validations to the graph to check for and validate they exist. ...
2
votes
0answers
221 views

Handler for jQuery DataTable search with filters and pagination

This AjaxCompound is invoked every time when the user types a key for search or click to sort. It contains 1million data 10 distinct rows by compound name. It takes 1.1 minutes and return only 1-5 KB ...
2
votes
0answers
129 views

A custom session with transaction support using Dapper

I wanted to write a custom session to act as proxy for a Dapper connection that could support transactions without having to expose any other DB related entities. At first, I thought of opening a ...
2
votes
0answers
180 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. ...
2
votes
0answers
190 views

Choosing which PDF preview to generate

I have a single controller that has two methods. One generates a PDF preview [GeneratePDFPreview] and then ultimately an actual PDF document [GeneratePDF]. It uses the Rotativa library to generate the ...
2
votes
0answers
437 views

Change the identity from Azure AD to identity of application and return new token

I use this code to change the identity coming from Azure AD in an identity usable by my application, then i generate a token for this identity and return it in the response headers. Is this secure? ...
2
votes
0answers
287 views

Switching between ViewModels using IoC in a MVVM WPF application

I have a project that uses Caliburn.Micro to implement the MVVM pattern. For IoC, I am using MEF. All the ViewModels are marked ...
2
votes
1answer
146 views

Using coalescing and conditional operators to check API arguments

I have a web application that allows users to create customs items and later change those items. For eg. a change, the application takes the parameters and performs some basic sanity checks. If the ...
2
votes
0answers
783 views

Parsing XML file from the REST API

Please suggest how I can improve my code (like memory leakage, which pattern to use etc.). I have to parse a book XML in two ways: first from an FTP file and second from the REST API. I implemented ...
2
votes
0answers
119 views

How to optimize code to only pull separate table rows that are necessary

I have a Company Class, and separate normalized Address Class. I did this because the Address table will hold more than just Company Addresses, so I don't want "CompanyAddress", "EmployeeAddress", "...
2
votes
0answers
120 views

Classes for an online shopping website, using a combination of Inheritance and Composition

I am developing an online shopping website. I have a class Item, which contains all the common attributes of all products (I will explain the interfaces at the end) ...
2
votes
0answers
311 views

Refreshing cell values in visible rows of a VirtualMode DataGridView

I have a DataGridView whose Virtual Mode property is set to True. When values of the underlying list are updated, those updates ...
2
votes
0answers
4k views

Active Directory: Retrieve all group members using DirectoryServices

I have written a function that will retrieve all active directory group members via DirectoryServices. I am using ...
2
votes
0answers
112 views

Implementing the IQueryable counterpart method of the IEnumerable method?

I have created this method to simulate SQL's IN operator: ...
2
votes
0answers
121 views

Initializing child windows in MvvM

I have a MvvM application that is working very fine. However I am not sure if I'm writing a clean code, especially the part handling child windows with their controller. So to begin, i have this ...
2
votes
0answers
3k views

Member management of Active Directory groups via an ASP.NET MVC website

Background One of the projects I'm working on is an Intranet website which is a front-end for several kinds of data, each aimed at a different set of users. Access to the website is handled through ...
2
votes
0answers
233 views

Generating data for Highcharts

I have written a code to generate chart data for the Highcharts library and need to know if there are any improvements possible. I have applied generics but think it could be fine tuned further. Could ...
2
votes
0answers
124 views

C# SDL2 Wrapper — Faster Viewport/Sprite Rendering method?

I'm using this SDL2 wrapper for C#, but since it doesn't implement classes such as Sprites, Viewports or Bitmaps, I've been trying to make them myself. Everything's going well and functions as I want, ...
2
votes
0answers
466 views

Producer Consumer Using TPL Dataflow

I have written the following class which is supposed to act as a consumer of messages that are passed in from producers and forward them onto amazon SQS, I have made a compromise by starting the ...
2
votes
0answers
1k views

Entity Framework with two databases (with UoW, Repository and Service Layer)

I have two databases: one for a warehouse, second for the office (The db design is out of the scope of this question). There are MANY cross-database funtions. One of those functions is ...
2
votes
0answers
147 views

EF mapping complex type to JSON in DB

I am trying to map a complex type to Json and store the info as Json in the DB using EF6 Code First. Here's what I have for now: The complex type ...
2
votes
0answers
502 views

RESTful API combining three other APIs

I have created a RESTful API that uses three other APIs with Visual Studio 2017 in .NET Core. It is the first time I have ever programmed in .NET so I am sure the code could use a lot of improvements. ...
2
votes
0answers
473 views

Leetcode 10: Regular Expression Matching

Problem statement Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching ...
2
votes
0answers
248 views

Learn trie through Leetcode 212

Problem statement: Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where "...
2
votes
0answers
83 views

C#: Foreach vs Seperate Threads?

Each 'Room' class instance needs to call the method 'ProcessRoom'. I am currently overthinking something and would like another persons opinion. One of the constant things here is ProcessRoom gets ...
2
votes
0answers
1k views

Prism find active/existing ViewModel

I was facing an issue where I want to retrieve existing/active ViewModels from the Prism runtime. Here's the code I've done to achieve it: ...
2
votes
0answers
760 views

Dynamic context.Set load and update/insert with using dynamic field in C# entity framework

I am writing an importer service. I have different sources and at the end I would like to push them into database tables. For different db tables, I am using different dbset in the context. I also am ...
2
votes
0answers
559 views

Is this how to implement MVP and ICommand patterns in WinForms?

I'm learning about the MVP and ICommand design patterns as I'd like to use them in my own projects. I've cobbled this very simple WinForm application together to hopefully demonstrate that I'm using ...
2
votes
0answers
983 views

Asynchronous sockets with begin/end and a state machine loop

Disclaimer: I am a C++ guy, so my C# is not even close. Therefore some review might be helpful. Here is my 4th attempt at a client using asynchronous sockets. Please give feedback. The hardest part ...
2
votes
0answers
231 views

Customizable Blockchain's block structure

I'm creating a new open-source blockchain framework for .NET Core and .NET Standard. But I have some questions about how to make block structure to be customizable and look beautiful. Let's begin ...
2
votes
0answers
1k views

Create a hierarchical tree with ordering field with entiry framework core

This is my model: ...
2
votes
0answers
936 views

Adding support of HTTP PATCH

I have an API endpoint to modify a race car, which supports the PUT method: PUT /api/racecars/{racecarId} Since PUT must be ...
2
votes
0answers
2k views

Serial Port Wrapper with Internal Blocking Buffer

Here I have some complete working code but some aspects seem questionable to me. What I have done is written a wrapper for the Microsoft serial port (...
2
votes
0answers
44 views

Getting right model from list

Im not a programmer, but somehow like trying to make something, almost like a hobby. As of now i have made a list of different gameobjects (models) and i need to choose right one from that list. ...
2
votes
0answers
333 views

Domain Driven Design Model for handling images

I have to create model which will handle various types of images in my app. INTRO Plan is to have one Image type which will be universal and then extended with ...
2
votes
0answers
695 views

Moving a player through a textual maze

I did this to practice a bit without thinking about optimization due to simplicity of this progam. It's a "maze game", the player is P and can step into the M by pressing Arrows on the Keyboard. At ...
2
votes
0answers
166 views

Fractal renderer in WPF

This was made mostly for fun, but also to practice. I'm generally looking for feedback on how to make the code run faster, any obvious mistakes I'm making in regards to using WPF, which I'm not at ...
2
votes
0answers
1k views

ISO mode encryption/decryption with BouncyCastle

I need to implement an ISO-mode encryption/decryption library in C# using BouncyCastle. In this mode, users only need to exchange their RSA public keys to securely communicate. Operation is as follows:...
2
votes
0answers
556 views

C# FileSystemWatcher Manager with Debounce

For a class last fall I was working on a "cloud backup" system. Originally in Pascal, I decided to rewrite it in C# and expand the feature set. Below is the FileSystemWatcher "manager" class which ...
2
votes
0answers
71 views

REST API design to handle status migrations

I have a requirement to provide an API which would allow to change status of Order. The API is supposed to follow REST principles, so I have designed an endpoint ...