.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

2
votes
1answer
28 views

Property validation

I require that the Feature set of my Licence to have a non-empty intersection with a set of features that the module I am loading contains. I expect other lists in my License to form similar ...
0
votes
2answers
86 views

Can this be written in a shorter way? Dynamic function call perhaps?

Below you'll find my switch case. My question is, for each function I am manually adding another case. Can this be somehow shortened? You see case names and function names are same. For example case ...
5
votes
1answer
26 views

Parallel extension enchancement

As suggested in comments here I created a new topic for next version. I edited a bit original code, added exception processing and optimization, that first N = 1/core count tasks are processed on main ...
1
vote
1answer
47 views

Multithreading extensions

I created a following class to manage multithreading without extra overhead, which exist when I use Parallel TPL class. It is also useful for systems without ...
-3
votes
1answer
44 views

Generating property for a class instance [closed]

Hope, it's my last question about current project. Yeah, it's still about respecting SOLID-principles. And it's still about calculator, so i've got realization of ITerm interface: ...
4
votes
1answer
65 views

Calculating a postfix expression

I've got the following code in my calculator project: ...
-1
votes
0answers
45 views

performance issue of application using entity framework 6

I have a console application in which I used Entity framework 6. In order to reduce the time of the first instanciation and the first read operations . I used Three ...
4
votes
3answers
287 views

'Retry' mechanism with callback

We've had a situation whereby we have to cater for certain exceptions and retry a particular method whenever these exceptions occur. This is required in various parts of the system. In addition, we ...
0
votes
1answer
75 views

Method or helper function to return objects from EntityFramework with Linq [closed]

The following code reads from Microsoft EntityFramework 6.0 domain model and returns the single view_patient object. The view_patient object is defined in the backend database and uploaded to the ...
3
votes
1answer
58 views

Recurring tasks in ASP.NET MVC

I have 2 alternatives for executing recurring tasks in ASP.NET MVC. We just need to add some code in Global.asax First alternative: ...
3
votes
2answers
40 views

Going to the thread pool and back using custom awaiters

I've figured out a way to switch threads in the middle of a method. The benefit of that seems super obvious to me: that's what everyone wants to do anyway, and splitting up methods, using callbacks, ...
2
votes
1answer
70 views

Recursive function application

I use a lot T4 templates and want to avoid extra code writing when it could be generated. Currently I have following class: ...
2
votes
3answers
86 views

Reflection optimization

In a web application I'm working on I have a class that Map objects to other (different) objects. It is implemented with something like: ...
1
vote
0answers
13 views

How to properly assess performance gain of CreateDelegate instead of pure reflection? [duplicate]

In a web application I'm working on I have a class that Map objects to other (different) objects. It is implemented with something like: ...
3
votes
2answers
91 views

Calculating template page numbers

I have a function which sets the text to a label displaying current active "products" and current active pages. The label displays "X products, Y pages/page" depending on the amount of products active ...
1
vote
3answers
144 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
177 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
1answer
97 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
84 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
109 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
115 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
126 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, ...
11
votes
2answers
89 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
66 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
97 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
165 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
286 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
79 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
170 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
134 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
111 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
261 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
101 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
198 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
67 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
53 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
328 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
152 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
85 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
44 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
92 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
138 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
122 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
32 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
32 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
292 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
62 views

Saving or updating to databse

What would be the best way to refactor following method? ...
4
votes
2answers
221 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
19 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 ...