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
0answers
32 views

Validating a collection of proxy servers with maximum possible throughput

I am validating a collection of proxy servers and trying to achieve the maximum possible throughput. I've tested a few different methods, such as Task.WhenAll, TPL ...
1
vote
1answer
96 views

Release the acquired lock after specific timeout

I'm trying to release a lock after some timeout. The lock is acquired to do any database changes so that multiple requests will ...
6
votes
2answers
8k views

Task timer async

I had been still using BackGroundWorker and decided to learn async Task. My test project is a simple timer that can be canceled. The target project is to read instruments with a delay for sampling. ...
5
votes
2answers
125 views

Combining SQL Tables into One Table in New DB with Similar Fields

I have a SQL Server Database filled with Reports all having the same schema. What I've done is created a .NET application to automate the process of adding all reports to a new table. How can the ...
5
votes
2answers
225 views

Combination and factorial

Combinations is how many ways to take k elements from n element. Combination is different from permutation in that order does not matter in combination. Combination is used a lot in poker ...
18
votes
8answers
2k views

Counting elements meeting a predicate in an enumerable without iterating the entire sequence

I was reading this question, and the answer that mentioned streams, and a thought had occurred to me. In many cases (at least in my usage) I want to determine if a sequence (or ...
4
votes
2answers
440 views

Populate null fields in an object through reflection

I have recently implemented this utility class for going through an instance's member fields recursively and assigning them default values if they are null. Here is the implementation in the ...
2
votes
2answers
427 views

Game Character class with many skills

Im creating a class that has all of my data in and can see it would quickly become messy. I feel that there must be a way of making it neater rather than making a new method each time For example. I ...
6
votes
1answer
613 views

Retry mechanism for failed downloads

I'm writing a mechanism to retry any failed downloads that respond with certain http error codes, I've noticed the server I'm downloading from will unexpectedly throw these codes to me and when I ...
4
votes
1answer
89 views

Handling a single connection to a server or client

I'm writing an asynchronous TCP server and client for a game in C# and in particular getting sending right is a bit tricky because calling BeginSend() before ...
3
votes
2answers
5k views

“Always stay connected” mechanism for socket connection

I'm calling Connect() for the first time I connect, I am then checking if the connection is still connected every 10 seconds if it is not connected it attempts to ...
3
votes
1answer
1k views

Memory cache implementation with a static class inside a normal class

I'm trying to implement a cache available in a data provider (repository). The data provider is a normal class, instanciated at every request made to the application. The reason I have a static ...
6
votes
2answers
441 views

Finding MinMax values and returning a tuple as a result

I was coding some tooling stuff when I started to ponder whether the best return type for a Range / MinMax method applied on a IEnumerable method. I am using the value the C# 7 Tuples like below, but ...
2
votes
2answers
98 views

Returning a collection inside of an IEnumerable method

The following scenario came out of a discussion I was having with a fellow developer on this project. He likes to execute an Ienumerable as soon as possible, hence ...
7
votes
1answer
941 views

Encryption and decryption on streams using AES CBC + HMAC SHA

The goal of the code below is to: Support authenticated encryption using AES in the CBC mode and using HMAC SHA. Support encryption and decryption of data of size larger than memory (potentially). ...
4
votes
2answers
134 views

DDOS Mechanism: Improving thread safety & loop speed?

I'm pretty new to this but I coded a DDOS mechanism for educational purposes. I need to know if the thread safety can be improved (Right now I have none, but do I need any?) and if the loop speed can ...
1
vote
1answer
115 views

Custom observable types and their supporting classes

I decided that for some parts of my project, communication through events would be very handy, for that purpose I started writing the most basic part of the event system, an interface consisting of ...
3
votes
1answer
4k views

Simple timer start and stop from console

Just a simple timer application for review. Stop and start the timer from the command line. The plan is to use this in a poker application to fold out a player if they don't act after a time ...
3
votes
1answer
106 views

Poker server as a service

This is very simple poker server. Target is a REST server. In real poker you do not act until action is on you (well you are not supposed to). On a server it is nice to accept action (bet, call, ...
5
votes
2answers
884 views

Custom enumeration classes

Lately I've been using a lot of enums in my project and the lack of generic Enum constraint seems to be quite problematic. This combined with few other headaches ...
2
votes
3answers
156 views

Singly-linked list queue

I recently learned the core .NET Queue type uses arrays internally, and that this is actually much more efficient. I've had a go at writing a singly-linked list ...
3
votes
1answer
153 views

Object pooling in WPF

In a WPF project I'm working on, often multiple objects reuse the same AnimationTimeline, to smooth that out I made an ...
10
votes
1answer
111 views

400 line method to cycle the movement for players in my game

I use this method to cycle the movement for players in my game. I've been told this method is too large and needs to be cleaned up into smaller pieces, I really can't see much that shouts out "put me ...
4
votes
1answer
69 views

Processing game user movement

This code is a cycle method. It gets ran every 500 milliseconds to process the movement for users in the game. I've been told that it's been poorly coded and could use some optimizations but they didn'...
8
votes
1answer
662 views

MVP Passive-View

First of all, I'm really new to the MVP design pattern (Passive-View) and I've been trying to implement it in a WinForms application. Before I'm going any further, I'd be very happy if you guys can ...
4
votes
3answers
432 views

Console word wrapping

I wrote a text adventure game a while back and today I looked at it to see how I did the word wrapping (to use in a new project); I'm curious if I went about it the right way. I realize I could use an ...
2
votes
1answer
100 views

Find sum of 3 that total a target from a List

A related Java question got me curios. All unique combinations (not permutations) of 3 values that sum to a target from a list of integers. Values can duplicate in the list but are only used once. ...
-1
votes
2answers
77 views

Improving predominance for updating 40000 records using entity framework [closed]

I have Two tables Circuit and Tag, Circuit ------------------ Id Name Path Tag ----------- Id Name Circuit_Id Now I have to loop through all the tags and ...
3
votes
5answers
6k views

Code to initialize a .NET object from a CSV file

I am initializing the following object from a CSV file: ...
3
votes
1answer
669 views

Implementing RecordSet-like class in C#

From the outset, let me state that I'm working with some older technology. I'd rather use Entity Framework, but I have to use what the client is using if I want to get paid. I am converting some old ...
10
votes
6answers
2k views

Poker dealer Hold'em

This represents a table (server) for Texas Hold'em. This is not a full Hold'em game but it is working code for what it does. It shuffles, deals the hole cards, deals the board, moves the blinds, and ...
3
votes
1answer
455 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 ...
2
votes
1answer
88 views

Event based input files management system

I'm currently making a system that can accept different sorts of files and some classes are interested only in specific types of files, while some don't discriminate at all. Note Type of file isn't ...
1
vote
2answers
283 views

MySQL database wrapper

Here is a wrapper to a MySQL connection. First I have a DatabaseController and then a DatabaseConnection. How I use this is ...
3
votes
1answer
163 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
0answers
42 views

Wrapping third-party component to use in windows service

I'm using a third-party commercial server component to listen for SAP IDocs. I want to run the server inside a windows service and the vendor recommends having a separate method to check the server ...
2
votes
2answers
82 views

Limit and merge saving operations

Use case: I want to automatically save data in the storage when a property of an object that implements INotifyPropertyChanged changes. Therefore I subscribe to the PropertyChanged event and call a ...
1
vote
1answer
326 views

Vertical & Horizontal Direction of a DataTable

I wanted to have a DataTable with cells in direction that is top to bottom or bottom to top and left to right or right to left. LR - LEFT to RIGHT RL - RIGHT to LEFT BT - BOTTOM to TOP TB - TOP to ...
1
vote
0answers
62 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
62 views

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

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
1k 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/...
5
votes
1answer
414 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
219 views

Console shutdown mechanism

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
53 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
1k 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
3k 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. ...
2
votes
0answers
884 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
216 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: ...
4
votes
1answer
1k 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 ...
1
vote
2answers
80 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 ...