Tagged Questions

C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

learn more… | top users | synonyms

4
votes
0answers
20 views

TestExplorerWindow, the event-tossing UI

Following up on Integrating Unit Testing functionality into an old COM-based IDE, I made quite a few changes to the UI, and now the code-behind for my ...
4
votes
2answers
38 views

Formatting checks against a session

This is the current code that gets put into a option box, is there a way to make this code more efficient and use less code ...
4
votes
1answer
48 views

Function to run MySQL SELECT queries with no leaks

I am upgrading an old massive website that is a Classic ASP \ ASP.NET hybrid. I still have a long way to MVC. Right now I want to convert all code that uses ODBC to the mysql connector specific code. ...
5
votes
0answers
42 views

Building multi-source Repositories and Units of Work

I am working in a shop where we tie into multiple different vendors to share data. I am also tasked with "bringing the code base up to the 4.x framework". To start, I understand that Entity ...
3
votes
4answers
72 views

Faster Way of Comparing Generic Sets

The following extension method is the limiting factor in the performance of an application I am developing, according to Visual Studio 2012 Performance Analysis profiler. Is there a faster way to ...
0
votes
1answer
52 views

LINQ method to create objects of different types

I have the following code inside a method: ...
2
votes
1answer
56 views

Speeding up the process of obtaining data

I created this script to obtain data from graphs online, from monavisaxmldata. But I were wondering if there was a way to obtain the data faster. The program which uses this data gets presented in a ...
-4
votes
0answers
46 views

making rpsls game in C# [on hold]

So, I have to submit Rock,Paper,Lizard and Spock Game tomorrow. And this is where i'm right now but i need help making the rules using the " if " and " else " statements. We have been studying C# for ...
3
votes
2answers
127 views

Overly interfaced or not overly interfaced?

I have to take over an old project that was coded in VS 2010 C# 4.0 in 2012. Interface programming seems to be all over the place and over-applied to me, but I am unsure if it is that way. I need to ...
8
votes
2answers
213 views

Parsing an XML File for a single word/phrase

this is a small part of my code that allows me to request a file through a load balancer, reading this XML file gives me the server's name (only node inside the XML Document) if the machine isn't ...
2
votes
1answer
35 views

This brittle OData to SQL Server C# code isn't sustainable over time

The intent of this code is to access a third party OData API to capture only the relevant data to an existing in-house set of MSSQL server tables. Ignore the exception handling for now--the errors ...
2
votes
1answer
46 views

Rotating a character upside down and vice versa

I have a pretty straightforward task, but I find it hard to figure out how to improve it. The code is pretty straightforward, but rather bad. There are some clarifications / extra details at the ...
0
votes
3answers
74 views

Cast an object to Decimal? or Int? etc but leave it as null if it is null

In a case like this: object A1 = null; Decimal? B = Convert.ToDecimal(A1); object A2 = null; int? C = Convert.ToInt32(A2); Note that in case where ...
6
votes
5answers
90 views

Effectiveness of masking a string

The assignment is to mask (or rather unmask) certain indexes from a string. Both the input string and the demasker are strings. An example shows how it's supposed to work. Input: "abcdefgh" ...
3
votes
3answers
147 views

ObservableQueue

I'm looking for feedback on this. ...
6
votes
1answer
53 views

Returning multiplied matrix array

Is there a more clever way of writing this piece of code? It does work but I thought there might be a better way of returning a matrix from multiplying the parameter by itself. ...
-1
votes
0answers
25 views

How to deal with passing parameters to methods which call other methods? [on hold]

First, I am sorry for the vague title, I find it hard to think of a clear title that describes my question. Feel free to change the title of you know a better one. In my code I often have a situation ...
3
votes
1answer
81 views

Getting information of countries out of a website that isn't using consistent verbiage

From this website I needed to grab the information for each country and insert it into an Excel spreadsheet. My original plan was to use my program and search each website for the text and later ...
4
votes
0answers
27 views

Server that supports two types of connections

I'm wonder if my approach is correct. I'm trying to make a WinForms server that processes data from 3 sides: from bluettoh (InTheHand library) as source data which I need to process in server to ...
3
votes
1answer
79 views

User Logged onto Windows

I created a Windows Service that Tracks which App Server a user is actually connected to through a load balancer. It retrieves the user that is logged into windows on that machine, then cross ...
6
votes
2answers
279 views

Can these lists and loops be refactored into something better?

I'm writing an application that needs to verify that an Active Directory user is in a certain OU or group. This allows me to tell if the user is a Field Agent or a Home Office User. However, I didn't ...
1
vote
0answers
38 views

Nhibernate repository for MVVM applications

I am developing a single user .net desktop application that lists numerous (over 2000) contacts sorted by an algorithm. I use NHibernate and did consider a session ...
2
votes
2answers
38 views

Changing IP of msloop

This changes the IP of msloop using WMI(Win32_NetworkAdapterConfiguration), which takes about 1~2sec. But, if I work on another computer, it works much much ...
6
votes
7answers
533 views

Project Euler #5 - Lowest Multiple of 1 through 20

I was trying to solve problem 5 of Project Euler, and this was I needed to do: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. ...
3
votes
1answer
38 views

Is there currently anything wrong with my custom authentication and authorization?

I have my reasons not to use the ASP.NET membership. Though this causes me some issues. I read about a thousand articles on ASP.NET MVC custom authentication and I've found that almost all of them are ...
5
votes
2answers
92 views

Quadratic Primes - Project Euler 27

Project Euler Problem 27 Euler discovered the remarkable quadratic formula: \$n^2 + n + 41\$ It turns out that the formula will produce \$40\$ primes for the consecutive values \$n = ...
3
votes
1answer
31 views

File Exists Script Task for SQL Server SSIS

I have an SSIS package for SQL Server 2008. In this package, I need to verify that a file exists that matches a pattern of SomeFileName_*.txt where the wild card ...
4
votes
2answers
75 views

Simple attempt to solve the travelling salesman prob

For practicing purposes, I created an application that attempts to find an optimal route between given points. The algorithm is: Connect two randomly selected points Select a point that's still ...
-1
votes
0answers
21 views

Advanced Game Item and Stat System [closed]

I have started making a game using C# and I'm looking for a code review to help point me in the right direction or give ideas as to better ways of doing some things. The requirements - these are ...
5
votes
2answers
164 views

Proper usage of “using” statement in base64 encode method

I used the example on here, but with little changes in order to write a base64 encoder method. I have a few points about the code: I would like to use using ...
5
votes
1answer
78 views

Basic console game architecture

I'm working on some simple console game and I'm starting to get stranded in my modelling. There is some fragmentation and tight coupling going on! In this version I would just want to be able to ...
3
votes
1answer
29 views

Syncing e-mails for multiple accounts

I wrote an email syncing program in my ASP.NET MVC website that syncs e-mails from multiple e-mail accounts to my database. Each e-mail account has to be independent from other accounts and they have ...
4
votes
4answers
732 views

Spelling a number in English

My Implementation: ...
1
vote
0answers
31 views

Supporting many checkboxes in a UI [closed]

Lately I have been working on a UI that contains many checkboxes. For all those check marks a Boolean is used. With the number of Booleans being quite large I was wondering what the best approach ...
7
votes
1answer
45 views

Integrating Unit Testing functionality into an old COM-based IDE

My UnitTesting add-in works nicely, but it has dependencies on a Reflection and a System ...
3
votes
1answer
52 views

Handling errors on a web application

I have this C# production code for handling errors on a web application. There are currently two applications that use the class. In each application I initialize the class within the ...
3
votes
1answer
110 views

How can I avoid repeated code using lambdas?

I have a method which should accept a Function/Action and do something with that method (in my case I've added retry logic). I'm wondering how I can remove the duplicated code (for loop, etc) from ...
1
vote
0answers
30 views

WPF Binding to a Repository with Entity-Framework

I have an MVVM WPF application that will make use (hopefully) with a repository and ...
-1
votes
0answers
44 views

2d race game movement [closed]

I'm making a 2d race game for my school project. The idea is that we make a race track where 2 cars wil race vs eachother. I'm only struggling with the movements of my car. I made a squire for testing ...
1
vote
1answer
57 views

Security of ProtectedObject

Is ProtectedObject really secure? Otherwise, do you have any advice? ...
1
vote
1answer
60 views

Memory cache service

I am repeating this code at lot of places: ...
1
vote
1answer
33 views

Console Application Customizer v1.0.0.2

GetBootstrap v1.0.0.2 a console customizer update from this Please give me tips, request and suggestion for my future updates. (I update every 2 weeks) Sample Preview The following code contains ...
12
votes
6answers
545 views

Check for balanced parentheses

I was given an assignment to check for balanced parentheses from an arbitrary string where parentheses are defined as (, [ or { and their respective "closing" ...
3
votes
1answer
49 views

CancellationToken and Reactive Extensions

I have a couple of calls that I need to cancel a subscription based on a CancellationToken. I saw How to cancel an observable sequence but I needed a more generic way. I created an extension method ...
0
votes
2answers
34 views

Safe DbContext Disposal

I have a service class called ClientService, the service class is called using an interface IClientService. The service class ...
6
votes
2answers
86 views

Basic C# calculator (+,-,*,/) - V2

Original question: Basic C# calculator (+,-,*,/) My 'teacher' requested this problem be solved by parsing the input into a tree based on the order of operations. The class Calc variables are ...
5
votes
2answers
203 views

Draw crosshairs on the screen - ZedGraph

Here's some part of my code is use to draw objects on the screen : Class members: ...
0
votes
2answers
82 views

Disabling selection in textbox

I have a form that displays a list of days in a given month that looks like so: All the text boxes are set as readonly, which is the desired functionality. While ...
3
votes
1answer
188 views

Best to name c# enums?

I have a simple enum, but I'm not sure how best to name/use it. ...
-1
votes
1answer
30 views