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
10
votes
3answers
166 views

Generating image gauges from a value, min and max

One of the things I was recently investigating was the ability to generate "gauge" charts—that is, a chart which shows where a value stands within a range of values. As an example, if we know ...
0
votes
2answers
1k views

Pull From Oracle into CSV File

I have written this code in C# to connect to an Oracle Database, omitting the tnsnames.ora file, then place results from a query into a CSV File. Is there more efficient way to do this? (Such as ...
2
votes
2answers
407 views

Substring a String from given start index and given substring length

I want to substring a String from given start index and given substring length. if the string is empty then returns String.Empty if the string length is greater than start index then it substrings ...
4
votes
1answer
303 views

From production to staging

The story here is about a console application that replays to a test system string clauses already imported in the production system. Looking forward to your comments. ...
3
votes
1answer
3k 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 ...
9
votes
6answers
9k views

Loop months between a time span yyyy-mm and yyyy-mm

I'm trying to come up with a more elegant solution for a loop in months that I wrote long time ago in C# 1.1 I use a helper class Month but I'd prefer to get rid of it and make the code shorter and ...
2
votes
1answer
152 views

A simple TicTacToe

A simple game of TicTacToe. Please review for style and other. Is this a proper ViewModel? ...
3
votes
3answers
1k views

Compare two Lists element-wise containing reference types

I am trying to compare two lists containing reference types (custom classes) element-wise, ignoring order. My question relates to the Equals method as shown below. ...
15
votes
5answers
31k views

Finding elements inside ExpandoObject

Is it possible to simplify the code below? ...
8
votes
2answers
8k views

SocketAsyncEventArgs send and receive

I been working on getting the SocketAsyncEventArgs to work the way I want it to work. Now I was wondering: is this going to work how it should work? ...
0
votes
2answers
82 views

Custom Comparison at the object

This question is NOT about passing a Comparison to a Sort. The question is how to pass a Comparison to an object for object to object (1:1) Comparison. Some users must be able to pass in a ...
2
votes
0answers
895 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 ...
3
votes
2answers
761 views

Find all the positive divisors of a positive integer

This came from this question. Find all the positive divisors of an integer >= 2. Can stop when i * i >= number. Please review for speed and style. ...
1
vote
1answer
944 views

Schedule matches for a season or round robin tournament

The algorithm comes from wiki. The output from the algorithm is correct but not something that a person could (easily) understand. See the wiki link above. Each team play every other team. ...
0
votes
1answer
2k views

Simple logger class in C#

I've been using logging libraries recently and somebody told me to try and write my own. I've kept it minimal but the only drawback is I can't log in static classes, due to TClass. Follow-up I'm ...
4
votes
0answers
36 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
243 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 ...
7
votes
2answers
17k 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
132 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
304 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
3k 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
835 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
806 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 ...
-1
votes
1answer
29k views

Proper way to compare two Dictionaries [closed]

I am implementing an IEqualityComparer for Dictionary objects and am looking for input on a couple of different approaches. I define equality in this case to be that both dictionaries contain the same ...
5
votes
1answer
10k views

H.264 image encoding using Media Foundation .NET

We have some video analysis software written in c# .NET that uses OpenCV via the Emgu.CV wrappers. The video frames come from a GiGEVision camera (not a normal capture device) which are then analysed, ...
6
votes
1answer
1k 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
104 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 ...
7
votes
1answer
2k 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). ...
2
votes
2answers
427 views

Console single player blackjack versus a dealer again

This is the second pass on this. pass one A single player versus a dealer. It does not perform bets - it only track wins and losses and has no splitting. Other than that I tried to get it all in. I ...
1
vote
1answer
527 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 ...
3
votes
2answers
9k 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 ...
2
votes
2answers
215 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
2answers
933 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 ...
4
votes
2answers
145 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
3answers
3k views

Simple web service call with retries

This code is actually pretty basic. Basically, I'm doing a large number of web calls. I currently do up to 3 Web Service calls simultaneously, one of which is below. There were 3 errors I saw in ...
3
votes
1answer
5k 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 ...
1
vote
2answers
516 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 ...
14
votes
7answers
44k views

Regex validation for Email Address

I need to validate whether my regex is correct for below scenario. Suggestion's if the regex is correct: Wiki Link Local_part The local-part of the email address may use any of these ASCII ...
1
vote
1answer
157 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 ...
1
vote
0answers
1k views

HTTP PATCH method for WebAPI

I'm working on an implementation of the HTTP PATCH method for WebAPI. I know there are packages like JsonPatch and OData Delta for that, but they don’t work for me. JsonPatch is too complicated and ...
6
votes
2answers
2k 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 ...
9
votes
1answer
1k 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 ...
2
votes
2answers
83 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 ...
4
votes
3answers
750 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 ...
11
votes
1answer
122 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
73 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'...
4
votes
2answers
2k views

Classifying a person by name, gender, and age using Chain of Responsibility pattern

I am very new to design pattern. Recently, I learned about the Chain of Responsibility pattern, so I tried to practice it. These nested conditionals are what I'm trying to replace with polymorphism ...
-1
votes
2answers
82 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 ...
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
1k 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 ...

1
4 5
6
7 8
23