.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

-3
votes
1answer
31 views

Best way to pass a LINQ query to a method [on hold]

I want to pass a result of a LINQ query to a new Form in order to create a graph on the data. I created a class: ...
2
votes
2answers
70 views

Is % needed when calculating template page numbers?

I have the working function below, which sets the text to a label displaying currect active "products" and current active pages. The label displays "X products, Y pages/page" depending on the amount ...
1
vote
3answers
120 views

A service to monitor CPU usage

I have written a windows service that I am currently not that happy with as I am facing design issues (first windows service). The aim of this service is to monitor CPU usage and send an alert when ...
5
votes
1answer
119 views

Navigation between pages in WPF MVVM application

EDIT: Here is the code repo: https://github.com/AntwanReno/navi I did a project in WPF MVVM. Just a single Window with single ...
3
votes
0answers
67 views

Inheritable ConfigurationElement values in .NET

I wanted to have a custom section in my app.config file in which any element could reference and reuse (or better said could inherit) any string value that is defined in it or above it in the element ...
2
votes
1answer
72 views

Custom data validation approach for store items and prices

I came up with a validation design for my project and wanted to hear if there's anything I could improve. Here's how it works. I have the models (code first) ...
3
votes
2answers
106 views

Save multiple group permissions in one go

The method SaveGroupStepPermissions(...) is a database API class. If an error occurs within the method the exception is trapped. Whether this is good design or not ...
4
votes
1answer
108 views

Parsing a string to extract values

I am writing some C# that will be running on Linux and will extract values from a kernel generated system file that represents readings from a sensor. The file contains two lines of text, and I have ...
5
votes
1answer
109 views

Minimalist countdown timer with C#

I'm looking to add a module to one of my utility classes that functions as a countdown timer for tools that execute tasks after a certain amount of time. The code below is what I have working for PoC, ...
10
votes
1answer
58 views

Markdown Markup Editor: MK2

Following on from this question I have added some more functionality to Markdown Markup, and made it more WPF idiomatic. It now supports saving data from any of the four boxes, and loading Markdown ...
5
votes
1answer
44 views

Markdown Markup Markleft Markright Editor

I have a blog that I occasionally post to, but it's a PITA because of the fact that it has it's own WYSIWYG editor and doesn't support Markdown. So I have to switch the WYSIWYG editor to the HTML ...
1
vote
0answers
78 views

Are there pitfalls to this solution to read messages from a queue in parallel?

I've posted a question on stackoverflow: How can I consequently read messages from a queue in parallel? I would like my own answer to be reviewed. Situation We have one message queue. We would like ...
3
votes
2answers
162 views

Handling events in a multi threaded environment

I have a service that raises multiple events, some of them can be raised at the same time. I need to process those events and run a potentially long running method based on the event arguments. What I ...
8
votes
2answers
257 views

Monitoring the clipboard

The following class monitors the clipboard and raises an event whenever the contents change. The monitoring starts when the class is created and ends when Dispose ...
4
votes
1answer
75 views

Task Scheduler for small interval and one number of start

Scenario: I want a task scheduler that enables my application to schedule some tasks in small time interval. I want to use it in my socket server application. For example, when the user connects to ...
3
votes
3answers
158 views

Unit of Work Pattern for creating users

CreateUser function assumes the data being delivered via parameters are clean and gets called or initiated from the Business Manager (another class). This function is responsible to do the following ...
3
votes
3answers
130 views

Enumerate list with filter criteria

Given the following CreditCard object, how would you get a count of unexpired credit cards? What are the pros/cons of using each method? Or is there a ...
2
votes
2answers
88 views

Producer/consumer implementation using Tasks and BlockingCollections

I'm implementing a Producer/Consumer but the generic interface doesn't require any knowledge of blocking collections or tasks. ...
5
votes
3answers
216 views

Sorting a list based on date and time

I have a class that is used to basically store samples from data being read from a system. Within that class is a property that I use to store the date and time of that sample: ...
1
vote
2answers
97 views

IoC.Resolve deep in the project or Constructor Injection on entry point of app

I'm building cross-platform application (every mobile/desktop OS + web in ASP.NET). I'm using Xamarin, so I can do everything in C#. But before I start working on UIs, I want to build soild, flexible ...
0
votes
1answer
134 views

Case of System.Timers.Timer vs System.Threading.Timer

I have a console application that I want to use to send an email notification every day at some time (call it 06:00 local time). To do so at the moment I am using a ...
2
votes
1answer
63 views

Calling getter or setter with expression tree

I have some part of my code that uses reflection and there is some slowdown issue that I have to fix. After some research I found that expression tree seem to be a good candidate to fix it also it ...
1
vote
1answer
48 views

Optimise MSSQL Connection .NET Helper Library

I recently posted my old .NET MSSQL Wrapper to be code reviewed: .NET MSSQL Wrapper I had some good feedback and based on that, I was able to re-factor it quite a bit and ended up with the following ...
5
votes
3answers
326 views

Fetching, adding, and viewing games

This is a simple application that will eventually manage certain files for video games. For now, I'm only posting code that handles fetching, adding, and viewing games. I'm trying to keep things ...
3
votes
1answer
140 views

.NET MSSQL Wrapper

Back in late 2012, I wrote the following C# .NET MSSQL Wrapper, which offered the following operations: ExecuteScalar (for selecting single field from a row) ...
4
votes
1answer
84 views

Compress numbers in a string array (#3, #1, #2, #4) to range (#1:#4)

This function takes a string array, {"foo", "#123", "#124", "bar", "#125", "#126"} makes a new array with the numbers converted to a range: ...
1
vote
0answers
41 views

Safely aborting thrid-party code using TPL

I'm using some third-party libraries in my project. Once in a while the code in these libraries freaks out and produces infinite loops and other nasty things. My goal is to write a wrapper that allows ...
2
votes
2answers
87 views

Index a document and perform analyses on its term vector

I have the following scenario: I create a lucene document from a potentially very large text. Apart from indexing the text, I perform some analysis on the document for which I need the document's term ...
0
votes
1answer
134 views

Static thread safe configuration class

I wrote this class. I would be very interested in your feedback how much thread safe this class is. I know users of this class must still use some kind of synchronization when using this class, but I ...
5
votes
2answers
91 views

Displaying a new image document in Picturebox

I'm using WinForms and have a picturebox in my form. This program looks in "C:\image\" directory to find a specified image document, in my case a tif file. There is always only one picture in ...
1
vote
1answer
24 views

Custom DataGridViewColumn to replace a DataGridViewComboBoxColumn

The issue that i'm trying to fix with this code is simple I have a huge dataset and I have to bind it (as readonly) to a DataGridView In that dataset I have some ...
8
votes
2answers
144 views

Yield statement in a using block from a clarity point of view

I want an opinion of the community about readability and maintainability of the following code. This is quite a rare case when yield statement included in a using construction. I know that this code ...
1
vote
1answer
31 views

Handling incoming socket data

Below I have some code that I use to handle incoming socket data, this is not full thing but its the part I am worried about, is there any way to improve this? ...
3
votes
5answers
282 views

Loading and converting data from CSV

My application imports a CSV file and parses each row, turning it into an object in my code. The speed for a 500,000 row x 68 column takes 2+ minutes to read. I've narrowed down the bottleneck to the ...
0
votes
2answers
61 views

Saving or updating to databse

What would be the best way to refactor following method? ...
4
votes
2answers
177 views

A set of Razor HTML helpers for disabling elements

I am developing a huge form with a lot of elements in it. The purpose of this form is editing one domain entity. Now, I finished developing the whole form and it just shows the bunch of text boxes, ...
2
votes
1answer
17 views

Optimize a regex validating a version string

I develop an application which installs updates. These updates have a version id (this version id is created as a part of the application and the format is a fixed requirement) and I use a regex to ...
2
votes
4answers
302 views

Implementing a thread safe log class with simple functionality

I have finally assembled an attempt to create a thread safe logging class and also ensured by file flags that file should not be accessed by different processes at same time. This classed will be ...
1
vote
0answers
80 views
2
votes
3answers
461 views

Demonstration of inheritance with some shapes

I had a job interview take home test where I was asked a series of questions on object inheritance. In addition to answering the questions, I created the following application to demonstrate ...
10
votes
3answers
941 views

TCP Client Class implementation in C#

I tried to implement following class which should handle connecting to a server, as well as sending and receiving data. Your feedback is welcome. Please note I am beginner in .NET and don't give too ...
1
vote
4answers
105 views

Update extremities losses when selected type changes

The following code works, but is it a good idea to call another method in a setter? ...
4
votes
3answers
59 views

COMpatible+ Google+ Integrations+ Scoping+

So I have part of a library which deals with scopes in Google+ integration, and I'm curious on the overall view of it. Yes, things are stringly typed in one of the methods, that is because this has ...
7
votes
2answers
135 views

Sum-based sliding rate limiting with Redis and Lua

As I'm new to Redis, I would like to get a review / improvement suggestions from Redis / Lua experts on the following problem and the solution I have found so far. Problem The context is: an ...
7
votes
2answers
250 views

CRUD commands to SQL database

I have a large application that focuses on using dependency injection. I've made a small (as I possibly could) piece of sample code to make this question more manageable. Essentially, I have a lot of ...
0
votes
1answer
32 views

CSV Creation from two tables with URL for user to click on

The code works but with an increase in data it's now slower so needs a tweak so looking for pointers. ...
3
votes
1answer
80 views

LINQ filtering query

I often find myself writing LINQ queries like this. I end up testing for Null and zero-counts pretty often, and the code sprawls out to be something like the ...
6
votes
2answers
249 views

Search on List<Tree-like structure>

I create a data collection system that has a tree-like structure built on the similarity to the pattern of the factory, and I have the difficulty in working with this structure, more stingrays lot of ...
10
votes
3answers
498 views

Google reCAPTCHA Validator: Iteration III

This is the third iteration of my reCAPTCHA validator. Iteration II can be found at: Google reCAPTCHA Validator: Iteration II It does almost everything required to do reCAPTCHA validation on anything ...
5
votes
1answer
93 views

Library to convert any number to a metric expression

For a small personal project, I was looking to write a number as a human readable number. For example: 1023 -> 1K 12345678 -> 12M Stack Exchange, like a ...