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.

Filter by
Sorted by
Tagged with
3
votes
1answer
803 views

Regular expression to parse guid and other attributes

I have this regular expression that extracts guid and couple of other attributes like name, type and version. Please review the regex for any optimizations and improvements. Strings are always in the ...
8
votes
1answer
1k views

Creating interactive tours for WPF applications

I am developing a WPF component that can be used to create interactive tours for WPF applications. To further improve the API in terms of usability and intuitiveness, the input of other developers is ...
3
votes
1answer
267 views

Game Packet System

Usually I'll have around 200 packets, but for the purpose of this question I've only include 1 packet in the code, the rest is the same principle as if there was still 200. Here is a packet system, ...
1
vote
1answer
126 views

Managing player data

Here is a code example from my name, where I use a MySQL db and store players data. In this code I'm using a DataReader when loading and saving the data in and out....
3
votes
1answer
151 views

Reading a string-to-string map from an archive

I have a CArchive Which contains a serialized CMapStringToString. From my research it is my understanding that it is quite ...
4
votes
1answer
7k views

Updating WPF image from camera frame grabber thread

I have created a WPF application in .NET 4.6.1. to display video from the frame grabbing event for a machine vision camera. In XAML there is an image control bound to a WriteableBitmap ...
1
vote
0answers
70 views

Tiny app to track working time on Jira tickets

I'm a .NET intern. For my project management we work with Jira and we have to track real working time on a ticket to log the work and compare it to the original estimate. For this purpose I have ...
2
votes
0answers
69 views

Convert Simple C# Console>Service to perform repeated API calls and file system actions [closed]

I was sent here from StackOverflow, as it was indicated that the quality of my current approach may have been questionable. I'm attempting to transform a simple console application so that it may be ...
2
votes
1answer
2k views

Service Layer, using Entity Framework 6.2

I would like you to review a part of my warehouse application, a Service Layer to be exact. The architecture of the program is: DB --> .Data (EF's DbContext/...
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 ...
4
votes
1answer
2k views

Running a collection of BackgroundWorkers one after the other

In my project, I had three BackgroundWorkers that can be run independently, but I also wanted to allow the user to "Run All" of them, but not at the same time. They ...
6
votes
1answer
833 views

Simple change tracker for POCOs

Problem I have a list of POCO model objects (approximatly 1.000 to 10.000) and I want to track changes on them: Check if at least one of the items has changed (to show the user that something ...
2
votes
0answers
261 views

Console shutdown mechanism [closed]

I'm trying to create an effiecent way to shut down my console application. To do this I have a while loop in my program's main method waiting for a request to shutdown. ...
-1
votes
1answer
57 views

Measuring class load times with utility method [closed]

When ever I load a new class I measure the time it takes to setup, initializing and load that class, it helps me debug the time it takes to complete actions within my application. Here I have a ...
0
votes
1answer
3k views

How to optimize a nested foreach loop which is creating same data object (with different values)

I have following code which gets MastrSegments from repository(entity framework). It's working but I think I am violating DRY (though not sure). MastrSegments conatins collection of SegReqs and ...
4
votes
2answers
4k views

Configuration class in C#, reading an INI file

This class will load a file with INI configuration elements and cache them, it then has a method to get an item from the cache if it needs to. ...
4
votes
1answer
288 views

Generic class for Unit of Work pattern

In my project I use the Unit of Work pattern and it works really well. The implementation is the following: ...
7
votes
2answers
17k views

Setting the value of properties via reflection

I am working on an application in which I have to parse an XML file. Nodes of the XML file corresponds to an object. I have to populate the properties of the objects at run time. The code below ...
2
votes
3answers
2k views

Add item to an Array 2D using LINQ

I've wrote a generic function to add an item to an Array 2D This is what I have: ...
1
vote
2answers
86 views

String to class variable initializer

I have a piece of code that takes a string array with 'key/value' pairs split with a ';' and finds the type of each variable and initializes the variable to the value given. The code given works as ...
3
votes
1answer
124 views

Group System in C#

I wondered if someone could give me some constructive criticism on my group system? Holds the badge parts for groups. ...
5
votes
1answer
1k views

Parsing a string using a regex and doing a mathematical calculation if there is a match

This is my first time writing anything in C#/.NET. I have written a simple function that takes a string, splits it, compares each split value with a regex and if it matches it'll take the second part ...
2
votes
1answer
814 views

Quest System in C#

I have created a quest system for a sort of game. The users will be able to complete quests by doing simple things and in return earn rewards for completing them. Handles everything quest related <...
1
vote
2answers
115 views

Slowed Data reader in C# [closed]

I am writing code to update data in the sample table (i.e. stbl) atoms of a video/audio file and found that in my method UpdateValues slows down to almost a crawl ...
11
votes
1answer
3k views

Injecting SelectList objects into ViewData to enable using EditorFor on dropdown based properties

I have developed a system whereby I use an attribute to state which SelectList to use for an 'FK' property. I would appreciate some feedback mainly on by good ...
7
votes
1answer
11k views

Factory pattern along with DI using Unity container

I am learning design patterns and this is my sample code where I have implemented Factory pattern and instance creation I have delegated to Unity container Framework(DI) to build the loosely coupled ...
2
votes
1answer
298 views

Cataloging digital media to a MySQL database

I understand .NET very well until Principles of OOP come into view, so I guess we can say very little. So to work on this, I am making a console app that will catalog my digital media to a MySQL ...
8
votes
2answers
9k views

Copy a similar list to another

My code works fine and I am just wondering is there a more efficient way to copy a similar list to another and ignore the properties which are not present. ...
1
vote
0answers
113 views

Thread-safe hashset that enumerates according to insertion order

According to the .NET documentation, HashSet<T> does not maintain order when enumerated so I implemented my own using F#. Can anyone help review if this is ...
1
vote
1answer
219 views

How to combine items in List<string> to make new items efficiently

I have a case where I have the name of an object, and a bunch of file names. I need to match the correct file name with the object. The file name can contain numbers and words, separated by either ...
4
votes
4answers
13k views

Get the brightest rectangle within an image

I wrote an extension method for bitmaps which finds the brightest rectangle (with specified width & height) within an image. Hopefully my code comments eliminate any confusion. If not, please let ...
3
votes
1answer
73 views

Subscription handler

I have so many classes like this in my solution but I've chosen this one just to show you guys what I mean by it. In my solution I have lots of classes that just follow the same 2 classes exactly the ...
3
votes
0answers
2k views

Cancel running Task on Dispose and race condition

I'm building a wrapper around NamedPipeServerStream and NamedPipeClientStream. Currently my ...
1
vote
1answer
1k views

Generate c# classes through XSD.exe automatically based on embedded resources in assembly

This program is supposed to take every embedded XML Schema file in an assembly and generate classes in the csOutPath. The names of the classes and files should match the stored schema and be put in ...
8
votes
1answer
5k views

Concurrent HashSet

I've recently been using HashSet and locking on each method, I found this to not only be a lot of work (was using it in a lot of places) but I started to see inconsistency in my code. I later decided ...
1
vote
0answers
189 views

RSA Encryption, improving programming practice and code quality?

This was my first go at any kind of encryption in any kind of programming aspect but my application needed some kind of RSA end encryption for my game packets. Uses RSA and diffihelman and runs off 3 ...
2
votes
0answers
84 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 ...
1
vote
0answers
70 views

Task/Thread/Timer Dilema

I'm looking to improve the performance, quality and effiency of the following code. I have a server I use for my game that manages all the players connected plus a few other things, which have Manager ...
2
votes
2answers
2k views

SqlCommand ExecuteReaderAsync helper method

The following helper method executes commands asynchronously and returns a Task<IEnumerable<T>> where T is a type that receives the row information from ...
1
vote
0answers
720 views

KDF computation using CMAC with AES (as PRF) using Bouncy Castle C# library

Using bouncy castle .net implementation (version: 1.8.1.0), I am trying to create an encryption key from a known master key using a key derivation function. The NIST Publication 800-108 contains ...
1
vote
0answers
83 views

Loop through records, change property of records, send mail for each

I am trying to basically do the following Get record from db. Loop through records and send mail out for each record. Update database records. I would like to know what is the most optimal way to do ...
2
votes
0answers
235 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 ...
1
vote
0answers
58 views

The Login Authentication Model Class for ApiController

This class accepts input parameters (Login and Password) from ApiController via ...
4
votes
1answer
146 views

Rare binary numbers

Rare numbers are the natural numbers in their binary forms in which there aren't two (or more) ones next to each other. Make a program that will give the N. rare number! For example: In case of N =...
2
votes
2answers
2k views

C# Extending the DispatcherTimer - Intermission timer

I'm working on a WPF project where a timer with Pause/Resume functionality is required. The standard Windows.Threading.DispatcherTimer doesn't offer that, so I ...
0
votes
2answers
4k views

Set Label content and make it disappear after 5 seconds

Let's say I have a label and a button. If I click the button, the label is set to some text, say "hello, world!", and after 5 seconds, it should disappear. Easy enough, right? I have the following ...
7
votes
3answers
2k views

Cached empty collections

I often need to return empty collections. One of those days I wrote the following to return a cached instance: ...
16
votes
6answers
16k views

Determine if an image is opaque or transparent

I wrote an extension method defined for the Image Class (System.Drawing) — which returns a Boolean value telling you if the image is opaque or transparent. The color of each pixel in the image is ...
3
votes
0answers
376 views

Extension methods with reusable logic - passing Action to Func<TResponse>

I have several extension methods for interacting with the Google Calendar API, and these all use an ExecuteWithRetry function for wrapping API calls within retry ...
3
votes
2answers
174 views

Getting a serial number from shared table

I have a table that keeps track of a global serial number shared between several tables. This is not the PK or unique id for each table. It is like a case identifier. Every time users create a new ...

1
5 6
7
8 9
23