.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

MIST - Auto-implemented, attribute-driven .NET Notification mechanism

I have a component that I've used myself for quite some time, the short story is that it automagically implements a property change notification mechanism (very useful for implementing ...
1
vote
0answers
28 views

Implementation of custom config section

i recently wrote my first custom config section. I have a collection of index files, each has a path and a savetime: ...
0
votes
2answers
83 views

Returning a byte array from a method [on hold]

public abstract class Element { // Removed for verbosity ... protected abstract byte[] GetBytes(); } I'm attempting to create an engine that can create a ...
11
votes
5answers
686 views

Reusable implementation of IComparable<T>

I often find myself implementing IComparable{T} in different classes for sorting in a very similar fashion: Values meeting criteria X and Y should be sorted to ...
3
votes
4answers
142 views

Property caching

Trying to figure out how to efficiently cache property calculations with dependency tracking to invalidate the cache. Here is the syntax I have at the moment (one ...
0
votes
0answers
19 views

Modeling of customers and suppliers as business relations [closed]

I'm getting started with Object Oriented modeling, so I thought this was a good question for Code Review. Let us consider that we are building a system which will be used by a company that has both ...
3
votes
2answers
404 views

Web crawler in F#

I have been writing a web crawler in F# that downloads pages with stylesheets and scripts. Can somebody give me suggestions on improving this code, please? Would appreciate any feedback that could ...
3
votes
1answer
53 views

Serializing objects to delimited files

For a new project I'm going to need to be able to serialize random types to TSV or CSV files, so I write a class which can be used to serialize any object to a TSV, CSV or any other _SV file you can ...
3
votes
1answer
91 views

WPF/MVVM with Entity Framework, Repository and Unit of Work pattern

I'm building WPF/MVVM application and I'm struggling implementing Unit of work pattern. The part, about which I'm not sure is UnitOfWork class. Here is my thought: ...
6
votes
1answer
74 views

Creating interactive tours for WPF applications

I am developing a WPF component that can be used to create interactive tours for WPF applications. To further improve the API in terms of usability and intuitiveness, the input of other developers is ...
0
votes
0answers
24 views

Prefered way to Inject a object with default properties using Ninject

I've introduced Ninject to an application, and want to understand if what we are running is as in line with best practice as can be. I have a simple config which is required by a service. I want to ...
1
vote
0answers
59 views

Tracking which entity properties have changed

There are a number of topics pertaining to entity change tracking. All the ones I've seen involve either 1) notifying when a property has changed or 2) merely determining whether or not an entity is ...
1
vote
2answers
67 views

Using session wrapper for accessing session data

When users log in to our website, we store some information in a session to retrieve it across the site. We created a few wrappers to help with data retrieval/storage to lessen duplication of code. ...
3
votes
2answers
37 views

Reg expression for finding expression in sentence

I have a regular expression that match the string that contains the word "duration", followed by a < or > operator and ...
12
votes
1answer
106 views

.NET 4.5 licensing subsystem using RSA-4096 strong name key, SHA256 signed XML, and assembly signature enforcing

Abstract For the past week I have been looking at taking advantage of the .NET 4.5 improvements to code signing and XML signing to produce a licensing subsystem I can use to license my own products. ...
4
votes
1answer
48 views

Minimize the console window to tray

I have a small console application that runs a very long task and I would like to hide the console window when I click on the minimize button but keep a notify icon in the system tray so that I would ...
3
votes
0answers
25 views

Event-driven UDP listener wrapper

I wrote this wrapper around the UdpClient,using events for new datagrams: ...
1
vote
1answer
54 views

Extension method to format properties that are not null and not empty

I'm trying to work with the following class, which is inside a library I currently cannot change: ...
8
votes
2answers
171 views

Can I stop validating email addresses now please?

Writing code to validate emails is a thing I don't like. It's usually pretty pointless as there's there is actually no right solution, so it leaves me with a certain sense of existential dread. I've ...
2
votes
1answer
67 views

Inheritence Cleanup

I have the following interface ...
2
votes
1answer
60 views

Extended WebBrowser control

I needed the ability to do a few extra things with a WebBrowser control on a .NET Windows Forms Form, and I found it needed some updates. So, I made a few. I added ...
0
votes
1answer
72 views

Data model decomposition into key value pairs using reflection and attributes

I'm trying to change how our system generates PDF files. Currently I have a class for each PDF that goes through the model for the PDF and fills in the properties. I want to change that to a self ...
1
vote
1answer
51 views

XSD Schema for optical media

I recently wrote my first XSD Schema: ...
34
votes
3answers
3k views

Benchmarking things in C#

I needed a better way to benchmark code, because, well, rewriting the same benchmarking code every time I need it is just...well...unpleasant. So, here's a class which does just that, it runs an ...
8
votes
1answer
101 views

Accessing the Stack Exchange API

Part of a project I'm getting started on requires access to the Stack Exchange API for certain data, as a result I built a .NET implementation to interact with it. The implementation is pretty ...
4
votes
4answers
222 views

Converting the DateTime to and from Unix epoch times

I'm currently working on a thing I needed this feature for. Essentially, these are two methods to convert DateTime objects to and from the Unix epoch time (two ...
5
votes
2answers
90 views

Indexed Property implementation

I have a class that encapsulates a PowerShell Runspace object which, among many other things, has methods for getting and setting variables in the session state. ...
1
vote
1answer
53 views

Copy a stream to a file using Universal .NET

I have answered to a question on Stackoverflow where Andy struggled to cancel a Stream copy to file operation using the Universal .NET Framework: Apparently, cancelling the cts CancelOperation token ...
1
vote
0answers
36 views

Current .NET session username injection in SQL Server stored procedures

I have a legacy WCF service that is ported from a security model using database logins and roles to a custom security. One effect of this change is that stored procedure are no longer executed using ...
0
votes
2answers
81 views
1
vote
1answer
29 views

Scoping resources per HTTP request

I am using this code in an MVC application to manage objects that should only have one instance per request. ...
5
votes
1answer
99 views

MVVM: Am I doing it right?

I read a lot of articles recently concerning XAML, WPF, data binding and MVVM. I also watched some MVVM tutorials and downloaded some MVVM samples. I finally got my first MVVM sample to work, but ...
3
votes
3answers
127 views

Performing parallel processing on a file

I have some code that reads a file and then does some parallel processing of the data. There are millions of lines in the file and this section of the code is the bottleneck in my program. Any ...
1
vote
1answer
61 views

Disposing of an SQL dataset

I am getting a compiler warning when running my code analysis. It is CA2202. It is saying that I have not properly disposed my dataset through all exception paths. Here is the code: ...
2
votes
0answers
40 views

Add transactional Units of Work to incorrect NHibernate usage (microsessions, single object actions)

This code is part of a quite huge repository using NHibernate in a wrong way: no units of work, but microsessions for every object loading and saving (ignorant of Persistence Ignorance, coded like ...
1
vote
0answers
48 views

UI code-behind for managing employees

I have a form code behind and it has what are called "Common Utilities". Basically the original author made a super class that is embedded into the main form code behind. What is the best way to ...
0
votes
1answer
54 views

Using EF 6.1 for updating objects and their children

I have an application that allows a user to create a poll that includes questions and answer choices as part of the poll. The hierarchy is a poll has one or more questions, a question has one or more ...
2
votes
1answer
49 views

Processor that would process an Object (say a message you received)

Sorry for being a little abstract but I have attempted to concoct something simple but it seems to spiral out of control. So I was thinking maybe I am taking the wrong approach. Here's what I am ...
2
votes
1answer
36 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 ...
-1
votes
2answers
91 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
41 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
50 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
47 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
75 views

Calculating a postfix expression

I've got the following code in my calculator project: ...
4
votes
3answers
327 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
107 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
179 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
51 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
76 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
137 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: ...