.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.

learn more… | top users | synonyms

0
votes
0answers
16 views

Color structure with single field for multiple properties

I'll get right to it, this struct is used a lot throughout my programme. This struct is responsible for only things regarding colour, not anything else. I'm ...
5
votes
1answer
41 views

Winforms Mathematical Operator Label

I wrote a custom class which (atm) displays the +, -, =, x, and ÷ operators inside a circle. Apart from the issue of some symbols not appearing in the exact center (everything except + looks a bit ...
1
vote
0answers
26 views

Cross-cutting delete flag in a repository

I want to have a cross-cutting delete flag in my repository. I have the following repository pattern at the moment: ...
5
votes
1answer
80 views

Reading a pointer to a string

What it is doing basically is reading an std::string from a given pointer. I was told that using a StringBuilder as I am is not ...
5
votes
1answer
246 views

Fastest De-/Serialise struct in .Net

I wrote this code to De- and serialise structures afap using IL generation (comments describes C# analogue). What can be improved here? ...
7
votes
3answers
116 views

Implementing Dynamic Network Message Handling (Part II)

This is an iterative review request of this other question I posted. As a follow up to that previous question, I changed the pattern completely and I went to an events-based approach, which might be ...
3
votes
3answers
200 views

Simplifying Cryptography Key Generation without Losing Security

I am writing a helper class for encrypting string and other data types. My goal is to make it as easy as possible to use, while still keeping a substantial amount of security. One issue I struggled ...
7
votes
1answer
91 views

Dynamic network messaging

I'm building a client and server for a game but wanted a generic messaging system in a shared library that let me focus on application logic and was largely separate form the underlying networking I/O ...
11
votes
2answers
135 views

Implementing Dynamic Network Message Handling

I'm trying to handle network messages in a dynamic, and effective way, though I feel I've overthought it again. As of now, I have a very structured approach, but it feels as if it's a lot of overhead ...
7
votes
2answers
112 views

User Password Encryption in C#

I am maintaining an old codebase of one of our legacy .Net applications which has a component that encrypts and decrypts user passwords using symmetric key cryptography. Since cryptography is not my ...
3
votes
3answers
99 views

Subscribing an Object to its own Events

Is it appropriate for the class to subscribe to its own events like this? Should the class not subscribe, and instead move that code to before the ...
4
votes
2answers
112 views

Trim leading zeroes from second component of a string

I have a collection of strings as follows: 44.01 44.02 44.03 44.04 44.12 46.05 46 ... and so on. I want to remove leading zeros from the component of the string after the full stop. ...
5
votes
2answers
97 views

Bayes rating selective term filtering

I am working on a project, and at the moment I have just finished the majority of the Bayes Rating/Classifier. I have two sets of methods I am most concerned about. Method set 1, will select a ...
6
votes
3answers
222 views

Generic getting single value from DB in C#

Few months ago I posted my code Getting a single value from the DB. I implemented suggested changes and this is how it looks like right now: ...
5
votes
1answer
55 views

User can choose to add one of two node types to a treeView, both of which have almost identical settings

There is a context menu that comes up when a user right-clicks on a node in a TreeView. They are then presented with the choice to either add what is called a "RWB" or an "AQ" node to the tree. Both ...
5
votes
2answers
108 views

Recursively merge dictionaries with generic types in C#

I am looking to implement a method that is capable of merging 2 dictionaries using generics. I've seen several great answers on SO already, but none handle the case of nested dictionaries. As in, what ...
5
votes
1answer
66 views

A Stream wrapper that executes all writes asynchronously

I wanted to make a Stream that can wrap another stream and buffer all writes, to increase performance; comparable to the ...
5
votes
3answers
240 views

Simple Service Locator

I've created a small, strongly-typed generic Service Locator object for .NET 3.5. It supports optional polymorphic service location and keyed services. I am looking for a general review, but ...
2
votes
1answer
73 views

Removing accents from certain characters

I have a method that I am using to remove accents from certain characters. The problem is the massive slew of characters I am expected to work with. I have to, basically, remove accents from all Latin ...
5
votes
2answers
108 views

External API calls from a C#.NET client

I have a simple c# mvc client that calls an external api..here is my attempt ...
4
votes
1answer
95 views

Daily Desktop Background

I've created a simple command-line program that downloads the Bing Image of the Day, then sets it as my desktop background. It is a console application, and closes immediately after setting my ...
4
votes
1answer
51 views

WebAPI Client Proxy

I'm working on a client proxy for my WebAPI. I've looked at WebApiProxy but I feel DTOs are unnecessary in my scenario. I made an ...
3
votes
0answers
60 views

Refreshing customer list periodically in the background

I have a method RefreshCustomersInternal that refreshes customer data from a server and returns a Task. Since this process is ...
15
votes
5answers
683 views

Populating a ListView with Items

I populate a ListView with Items. Each Item has data attached to its .Tag property. Over time, I have needed to handle many cases where something would be null or ...
2
votes
2answers
135 views

Using ActiveDirectoryMembershipProvider with ASP.Net Identity?

I was told in SO to bring this question here. So here goes - I am trying to learn how to use ASP.Net Identity. My scenario is that I have to authenticate against Active Directory. For that purpose I ...
2
votes
0answers
77 views

Rx.net File watcher

I am new with Rx.net and tried to do a folder watcher that could send a notification when a new file is done being uploaded. Each instance check one and only one folder. Here are the steps to achieve ...
4
votes
2answers
91 views

De-serializing and serializing objects to be sent over the network

I am serializing and de-serializing a class object within the class which is then sent over the network like this: ...
1
vote
2answers
157 views

Check before proceeding if the task in BackgroundWorker has completed

I have a Login Form (which has a label that will show status of background process, username and password text boxes, Login and Cancel buttons) along with that I have a background worker to do some ...
4
votes
1answer
173 views

Web API using Repository / UnitOfWork

I'm looking for feedback on a repository I set up based on a blog post I read here. I have just recently got more into .NET within the past year, so any feedback and/or best practices that can be ...
4
votes
1answer
125 views

Throttle actions by number per period

I want to throttle asynchronous actions at a specific maximum rate of n actions per t period, and have pending actions wait until there is a free slot (rather than drop them). I want to receive the ...
6
votes
2answers
120 views

Color-coded console output

I wrote this Console.Write function to use in my applications where I need to easily color-code output. Example syntax would be: ...
3
votes
1answer
109 views

Using composition instead of inheritance

I have been using Entity Framework 6, AutoMapper, ASP.NET Web Api and hit a few problems along the way, each time it was recommended that I could change my code from Inheritance to use composition ...
8
votes
1answer
116 views

Fun with CallerLineNumberAttribute: clever hack or terrible idea?

One fun feature that was added (fairly) recently in .NET is the [CallerLineNumber] attribute, which, in conjunction with ...
6
votes
5answers
175 views

C#/.Net 4.5 - Number Guessing Game

I'm currently enrolled in an introductory C#/.Net 4.5 course and one of the things I want to focus on is the quality of my code. This is the first assignment our instructor had us do, the ...
3
votes
2answers
41 views

Registering endpoints and HTTP method for exemption of authentication

I have a set of API endpoints where the URL is not standardized, so I could either get "api/auth" or "api/auth/" (may or may not end with "/"). I'm 'registering' the endpoint, plus the HTTP Method ...
4
votes
2answers
103 views

Type Name or Alias via Reflection for TT Code Generation

I was working on some TT code generation to get rid of mundane C# codings in VS2013 Express Edition, and after researching online, created the following helper methods to facilitate Type declarations. ...
-1
votes
1answer
172 views

Using async & await

I've been experimenting with some old code that needs refactoring in places and was testing if there was any improvement to iis threads etc by uploading file asynchronously (Server Side). I'm using ...
2
votes
1answer
53 views

Shared access point

In my game, people connect to my server. The server creates a GamePeer per connection. GamePeer creates one ...
5
votes
1answer
100 views

Implementation of the FNV-1a hash algorithm for 128-, 256-, 512- and 1024-bit

A little over a year ago, I asked this question. Since then, I've implemented the larger bit variations and am looking for any and all feedback - performance is obviously key when talking about ...
7
votes
2answers
214 views

Using Roslyn to find interfaces within a solution

The intent of the below code is to find all interfaces within a solution whose fully-qualified names match the given predicate. It seems to work, but as I am new to Roslyn I'm guessing there are ...
3
votes
1answer
198 views

.Net BouncyCastle - CSR and Private Key Generation

The purpose of this code is to generate the CSR and the Private Key. The scenario is that we have some clients for whom we run websites and for the SSL component we want to have a page on our site ...
-4
votes
3answers
133 views

Application search form

I have a search form in my application. When I search, it takes too much time to retrieve and display data, so I need to optimize this code. ...
5
votes
2answers
125 views

Using Linq syntax, how can I remove the select n+1 issue in this method?

I have the following code in a validation module. It works the way I want it to, but it has an obvious select n+1 problem. I would like to refactor this code to make a single call to the db to perform ...
8
votes
3answers
182 views

Collection that can be modified in a foreach

Sometimes you want to add/remove items from a collection inside of a foreach loop. Since this isn't possible, a common pattern is to add the items to a separate ...
4
votes
2answers
84 views

Generic object pool class using Spinlock/Monitor

I've written the following object pool class, and because this is my first encounter with synchronization primitives, I need reinsurance from an expert that this code is safe. I've tested it myself ...
4
votes
1answer
475 views

Async distributed locking with StackExchange.Redis [closed]

I have been trying to write an analogy to this approach to distributed locking with two differences: making it asynchronous making it work with StackExchange.Redis rather than AppFabric Cache. My ...
4
votes
1answer
221 views

Is this pattern of Task queueing acceptable?

The AsyncWorkerQueue class uses TPL Data Flow and Rx to async process and cancel work in a queue. It takes in a worker factory (Func) and executes it when its turn (or not if its scheduled to be ...
5
votes
2answers
112 views

Go through every pixel of an image and then dispose of it

I'm a little confused as to whether implementing the Dispose method serves a purpose in this code. It never gets referenced by any other class in my project, so ...
3
votes
2answers
154 views

Thread Safe Objects in CSharp - ConcurrentDictionary

I'm using ConcurrentDictionary to hold the records.. I'm reading files from the local system in parallel, to speed up the process. Sample 1: ...
1
vote
3answers
59 views

Initializing object by settings implemented as a class [closed]

Here is the story. We have the BankTerminalSettings class. It has many properties: ...