.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

6
votes
5answers
510 views

Checking if a text contains N consecutive repeating characters

I want to check a text for consecutive repeating characters. For example, with a minimum of 3 consecutive char's, this should match: Okeee OOOkee Alsoook This should not match: No not okee, oh ...
4
votes
2answers
75 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 ...
5
votes
2answers
48 views

Calling functions with different variable types

I need to call the function that will get the value of a datatable cell with the ColIndex, either a text (column name) or an integer (...
3
votes
1answer
53 views

Simple Vector2 structures (and interface)

I built a couple Vector2 structures (Vector2 and Vector2F) for use with a particular ...
5
votes
1answer
52 views

Generating controls based on PropertyInfo

This is a class that takes a PropertyInfo and makes a Control for it. You can access the value of the control through a property on the class called Value. ...
5
votes
1answer
81 views

Inventories, Containers and Filters

Coming off a comment on this question, I figure it cannot hurt to post my Inventory work here as well. Basically, I have Item, ...
15
votes
4answers
383 views

Entities and the things they do

So I have an Entity, which is responsible for providing an abstract base for other objects to inherit. (Like Actor objects, ...
1
vote
2answers
30 views

Cameras and ITrackableObjects

The purpose of these two classes (and hence why I am including them together) is to allow you to create a Camera, that indicates a "render zone", and track an ...
7
votes
3answers
217 views

XNA KeyboardStateManager

This class allows for easy management of the KeyboardState of an XNA game. It provides a simple, easy-to-use API for interacting with the Keyboard and getting ...
4
votes
2answers
88 views

Creating and Editing a UtilityMeter

I have some functionality that allows the user to create a Meter, which counts your gas, water, and electricity usage. A Meter ...
3
votes
2answers
97 views

Calculator with WPF

I built a calculator in C# with WPF for the UI. I'm still a beginner at WPF and C# in general, and I'm just looking for some constructive criticism. XAML ...
2
votes
3answers
154 views

XML serialization helper class

Yesterday was JSON serialization, today is XML serialization. I've taken some of the suggestions from there and made modifications, as well as making other modifications that were not suggested but ...
2
votes
1answer
64 views

JSON serialization helper class

I wrote this class to one-line all my JSON serialization, and I'm curious of any input on it. It's only responsible for serializing/deserializing any type to/from JSON. The comments and code are ...
2
votes
2answers
64 views

Framerate Measurement Utility

As part of a project I'm working on, I need to measure FPS. In the past, I would do this within the actual project itself, but recently I've been trying to implement more abstract (and reusable) ...
7
votes
2answers
53 views

Drag and drop single files on different targets for different purposes

I have three text fields (DevExpress ButtonEdits set to read only) on a Windows Forms app. They look like this: They're used by dragging and dropping a single ...
7
votes
5answers
522 views

Return Nth Weekday of Month

My goal is to obtain the nth weekday of a given month. Parameters are a date from a given month and the nth weekday I'm trying to obtain. It returns the Nth Weekday of the month if it exist and ...
0
votes
1answer
165 views

Service receiving and sending messages – multiple protocol versions

I need to design and implement a service (C#, .Net 4.5+) which receives messages, converts the messages to BLL models and passes them to the BLL. Long story: The service will receive messages ...
7
votes
2answers
141 views

Color structure with single field for multiple properties

This struct is used a lot throughout my programme. This struct is responsible for only things regarding colour, not anything else. I'm largely concerned of the ...
5
votes
1answer
54 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
1answer
45 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
96 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
269 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
123 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
212 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
106 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
140 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
195 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
104 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
126 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. ...
4
votes
2answers
120 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
251 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
113 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
84 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
277 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 ...
3
votes
1answer
91 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
191 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
116 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 ...
5
votes
1answer
63 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
74 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
743 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
218 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
106 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
108 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
185 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 ...
5
votes
2answers
217 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
188 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
141 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
112 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
119 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 ...