.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

4
votes
2answers
67 views

Method to separate a list of ports to scan

I'm building a port scanner as an exercise. It contains a method to separate the ports that the user wants to have checked, which can include single ports and port ranges, ex: 22, 23, 80-120, 443-500, ...
5
votes
1answer
30 views

HTTPCache and MemoryCache cross dependency

After asking a question on StackOverflow about the two .NET caching systems taking dependencies on each other I gave implementing them a go. I posted them as my own answer there but before accepting ...
4
votes
2answers
41 views

C# with Oracle ODP.NET

...
3
votes
1answer
70 views

Using model view presenter (MVP) in C# code

I'm a beginner to Model-View-Presenter pattern and I'm finding a way to use it in a sample application In my C# winforms application has a Employee Class and it ...
11
votes
2answers
235 views

Displaying data from a database onto a form

I'm a beginner to .NET and could you guide me to right direction. My problem is based on the following code. Here I have 4 variations of same method and all 4 variations are working fine. What is ...
3
votes
1answer
74 views

Unnecessary unit test?

I have this method in my service layer ...
3
votes
1answer
81 views

Searching text files for string patterns that are each defined in their own classes

I'm trying to implement interfaces in my design but not sure if this is correct or if there is a better way to do it. What I need to do is open a text file keep searching blocks of text until I ...
2
votes
1answer
54 views

Parsing MWNumericArray to C# code optimization

This is my function returning matrices from Matlab. This code run very slowly. I was trying to use Parallel.For in-order to run it in parallel threads but I got ...
-1
votes
1answer
30 views

Is it in bad form to use “Model” as a model class suffix? [closed]

I have the following setup but I'm worried that using Manager and Model as a suffix might be frowned upon to other developers. I, personally, like it because it makes everything clear, visually, when ...
11
votes
2answers
95 views

Parsing Valve Map Files (VMF) into a tree like structure

I've written a small library of objects for parsing of Valve Map Files (VMF). These files are always generated and exported from either the Hammer World Editor, or a Source engine built in map making ...
1
vote
1answer
169 views

Unit testing - test class inheritance vs single test class [closed]

Which unit testing approach and WHY do you prefer? Inheritance-driven-testing ...
10
votes
3answers
153 views

Simple Linked List

I've implemented a simple linked list in C# using generic T for values. I did not inherit from any of .Net's fun and helpful classes like ...
12
votes
1answer
66 views

RPSLSMB OOP Version 2

Rock Paper Lizard Spock Monkey Banana My original post Based off of Malachi's post I've changed the way rules work in this version to allow ties to result in double loss or double win. While ...
8
votes
3answers
96 views

RPSLS refactored to Object Oriented

I wrote a couple reviews for this CR post. In my most recent review, I refactored @Malachi 's code to fit OO design. I'm looking for any advice/hints/criticisms on it. A Review is welcome for both ...
6
votes
1answer
67 views

Optimizing email alert code

To avoid switch statements at multiple places, I wrote the following code. This was based on articles found in the Google search. The object names are not real in ...
4
votes
2answers
77 views

comparing objects; optimize code short of using reflection

I'm comparing two distinct instances and if they are not the same I save to the dB, so I've given snippet of code below of the way I am comparing these instances, I realize I could use reflection and ...
3
votes
1answer
56 views

Session state wrapper, extending an existing application

I'm adding additional functionality to an existing MVC .net application, and to help prevent or at least reduce repeated reads to the dB I'm dumping a few custom entities in session. I'm limiting what ...
10
votes
5answers
284 views

Is there any way to simplify my complicated code with finding elements inside ExpandoObject

Is it possible to simplify the code below: ...
3
votes
1answer
136 views

Async TcpListener

I'm trying to implement a TcpListener using the TPL. I'm not sure If I'm doing everything correctly though. I'm trying to keep the code as small as possible as well. It all works fine in a console ...
2
votes
1answer
81 views

Are there any improvements I can make to my implementation of the strategy pattern?

I'm not sure about that if else statement in function Change(). I'm guessing there is a way to eliminate this and make better use of OOP principles. Does anyone have any suggestions? PS This code ...
10
votes
3answers
212 views

Design pattern for implementing multiple data sources

I've written a program to populate a particular object from multiple data sources, however I'm not convinced I'm going about this in the right way: I have no idea which (if any) design pattern I ...
12
votes
3answers
599 views

Is decoupling necessary for very small applications?

I threw together a small solution for my organization today for some basic data review and approval procedures. This particular application will likely not change or add functionality at any time. ...
2
votes
1answer
32 views

Login script check

I have written a script that sits on the admin portion on my website. Here I assume the user is valid as I have code that checks that already. The below code is checks if the user is Admin. If they ...
1
vote
1answer
331 views

MVVM implementation using C# and XAML

I have used INotifyPropertyChanged for both Model and ViewModel. Is it correct? First of all I was trying to use ...
0
votes
2answers
51 views

Interface of an authorization subsystem [closed]

I need to just design the interface of an authorization subsystem. This is what I have so far. What else would you suggest or change in the interface? For example, HR can see everyone but not their ...
2
votes
1answer
43 views

Numerical precision of implementation for convex quadrilateral area

I have implemented a method to compute a convex quadrilateral area in R3. The method works fine, but I am having numerical precision problems in the 8th decimal place. Take a look on the method: ...
1
vote
1answer
134 views

Simple async/await progress bar

In researching the new .NET Async and Await keywords in .NET 4.5, I created a simple example showing how to update a progress bar and a label while an async function is running. I also included how to ...
1
vote
2answers
56 views

Exposing WCF Service with dynamic search operation

I have this WCF service providing search functionality - to be used by our client in his web application. There can be any number of search parameters and possible nesting of ...
5
votes
1answer
76 views

Inserting text file rows into an Access DB - Optimizing

How can I improve my inserts? I am trying to speed up the process of inserting all of the rows in my text file into an Access DB. I originally switched to this route because of the size of those text ...
3
votes
1answer
90 views

Run control tasks asynchronously using TPL

One of my classes regularly triggers one of two asynchronous operations: a "turn on" and a "turn off" that each take about a second. I'm using this method below to make sure that they don't run ...
4
votes
1answer
241 views

Reading a configuration file in c#

The configuration file of my app is similar to, ...
7
votes
5answers
225 views

Reading from text file with RegexMatch

Below is the method that I have written for reading from a text file. While reading, I need to match line string to given regex and if it matches then I need to add the line string to a collection. ...
4
votes
1answer
34 views

Conditionally write to a compressed stream

My Import method takes some data and writes it to a stream. If the CompressedStore property ...
6
votes
3answers
143 views

Repository pattern review, question about when dispose the Context

I have a question about the Repository pattern. This is my repository: ...
8
votes
1answer
223 views

DTO pattern: what is the right way to tell client that there is no result?

This is how I handle this situation right now: For example, I have service that returns UserDto by user ID: GetUserById. Service never returns null or throws exceptions. Service always returns DTO ...
7
votes
3answers
241 views

A custom Undo Manager

I am working on building an UndoManager in C#. The concept is to store events and property changes in a ...
0
votes
4answers
147 views

Which code is more efficient to use? [closed]

1) private void button1_Click(object sender, EventArgs e) { string name = comboBox1.SelectedItem.ToString(); } 2) ...
4
votes
1answer
419 views

Thread-safe wrapper around WCF ServiceModel.ClientBase subclass

I have an ASP.NET application which uses a Service Reference to a (third-party, offsite) payment processor. The service reference class is generated automatically. Its implementation is a subclass of ...
2
votes
2answers
153 views

Game launcher for The Sims 3

Is there a way I could improve my code's readability, or have I finally won the war against sloppy coding? Here's a game launcher I made for The Sims 3 to fix the awful performance caused by big ...
1
vote
1answer
138 views

Avoiding Duplicate Boilerplate Code in WCF Service

I'm responsible for maintaining a web service project in c#. I have one service class with a bunch of methods that look a lot like this: ...
3
votes
1answer
66 views

GameState Management efficiency

So I've read numerous tutorials on handling game states in XNA, and to each tutorial I've been read, it was different from the others. Now I want to ask which way is more efficient? I've created my ...
4
votes
3answers
113 views

Extracting pattern and simplifying testing

I observe the same pattern in a number of my classes but can't extract/abstract it due the tight coupling inside each particular implementation. Having the class accepting an optional number of ...
0
votes
1answer
103 views

Is such style good for using unsafe features in C#? [closed]

Is such style good for using unsafe features in C#? Or, why is it bad to develop such code? ...
2
votes
2answers
130 views
3
votes
5answers
592 views

Is there a better, more efficient way than Dictionary(Of Tuple(), MyClass)?

Suppose I have data coming from different sources that tells me information about a large group of stores that has the following (just an example): Necessary to define what store we're dealing with: ...
4
votes
1answer
88 views

How can i reduce this code?

I have a problem. This code works great, but i think it can be reduced. ...
4
votes
1answer
451 views

Creating a reusable C#.NET Oracle Query Builder - Returning Dictionary for custom format

Disclaimer My first post to code review, and I'm a fairly new C#.NET developer. Feel free to not be gentle so I can move forward. I hope this post meets the requirements set forth o.O Also is ...
3
votes
3answers
138 views

String Extension improvement

I am creating a string extension to validate some input. My scenario is when we have a string it will format it according to following guideline. If the sample string is “One Two Three Four Five” and ...
4
votes
2answers
2k views

AES Encryption C# .NET

I have written a tool for encrypting string using the AesCryptoServiceProvider in .NET. The folllowing parameters are used: Block Cipher Mode: CBC Initialization Vector: 16 bytes (randomized per ...
6
votes
2answers
216 views

Simplification of byte array comparison algorithm

I have an algorithm that evaluates in input byte[] with a source byte[]. Several conditions can be encountered: Match found No ...