Questions tagged [c#]

C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform. Use this tag for questions related to C#. In case a specific version of the framework is used, you could also include that tag; for instance .net-2.0.

Filter by
Sorted by
Tagged with
10
votes
2answers
651 views

Loops for removing unnecessary lines

I have the following method: ...
12
votes
4answers
5k views

Calculating totals of a transaction

I am working on a project where I have to calculate the totals of a transaction. Unfortunately, coupons have proven to be quite an issue. There are four types of coupons: transaction percentage, ...
21
votes
5answers
12k views

MVVM, WPF Ribbon V4, with Prism

This weekend I've been having one heck of a time getting WPF Ribbon v4 working with MVVM and Prism (using unity). After much trial and error, I believe I have it working. I was hoping someone could ...
2
votes
2answers
11k views

Directory write permissions check

Consider the following method that I have for checking write permissions on a directory path: ...
9
votes
2answers
4k views

Animating the color of a line in WPF

I'm thinking about how to do a color transition for a line in WPF. I'm looking for this to be as simple and succinct as possible, and also the "correct" way in the WPF world. This is what I have, ...
31
votes
6answers
83k views

Parsing console application arguments [closed]

In our console app, the parsing of application arguments is done like so: ...
10
votes
3answers
2k views

ASP.net custom user control design

I've built a custom control that generates a tab style navigation. Each page might have different tabs to display, the aim was to modularise it so I can make global changes to all the tabs. TabMenu....
13
votes
6answers
2k views

"Do you owe the government?" classes

Should my class pass parameters internally or reference class level scoped variables? I'm not sure on the best approach or style for procedure calls that have parameters. Should I go with the class ...
14
votes
6answers
1k views

Form to create new students or view existing student information

I started out with the best of intentions, but this form got hacky real fast. It's purpose is to serve as a create new Student form. Also, if you want to view an existing Students information. Think ...
3
votes
1answer
2k views

Better way of setting input scope on text box in WP7 [closed]

This works but there must be a better way: txtBox.InputScope = new InputScope { Names = { new InputScopeName { NameValue = InputScopeNameValue.Text } } };
25
votes
4answers
13k views

Interface for unit of work pattern and repository pattern

I'm trying to design a well defined yet simple interface for the unit of work and repository patterns. My UoW's are exposed to services and services then "get repositories" that it needs to query. I ...
33
votes
3answers
16k views

Administration Elevation

I'm looking into Administration Elevation and I've come up with a solution that seems like it's perfectly sane, but I'm still in the dark about the professional methods to accomplish this. Is there a ...
75
votes
8answers
223k views

Getting/setting default values from my App.config

Imagine that I need a color palette for my Winforms application to have a consistent look. What I did was create a static helper class and helper methods that I can call from anywhere in my code, and ...
21
votes
3answers
16k views

Determining if a connection has been made to a communications device

I am unsure if my use of Monitor.Wait and Monitor.Pulse is correct. It seems to work alright, but there is a nagging doubt I am ...
21
votes
3answers
4k views

Converting from polar coordinates to rectangular coordinates

This is performance critical. I measured and determined that using the sqrt is faster then using the cos method. I am aware ...
9
votes
5answers
951 views

Update grid from source hierarchy

In this question I answered with this Linq. While it does what I was looking for, I am not sure how easy the linq queries are for others to follow. So I am looking for feedback on formating, what ...
11
votes
5answers
2k views

Simple ASP.NET C# class design

Here's a class I'm designing: ...
9
votes
1answer
713 views

Parsing a game file

Note: This file is out of my hands. I cannot change the format or type of file I have to parse. Here is some sample data that I'm trying to parse. This is information for just one player: ...
17
votes
7answers
2k views

Parsing a file for a game

Is this code good enough, or is it stinky? ...
13
votes
4answers
1k views

Counting the number of points that have both a larger theta and a larger radius than a given point

I don't like the fact that I am selecting all the points, even though I only care about the count of them. Which of the from parts should appear first, if it even ...
23
votes
5answers
20k views

Best way to pass parameters to Factory class?

So I have a series of objects, which I will call Impl1, Impl2, and Impl3. They each implement an interface, called IImpl. I have a Factory class who's task is to retrieve the ImplX which is ...
67
votes
9answers
29k views

Implementing a Singleton pattern in C#

Is this the best way to implement this pattern in C#? ...
13
votes
2answers
6k views

Implementation of a PID Controller

I've implemented a PID controller, but seeing as I'm not an expert in control theory, have I missed any edge cases? ...
23
votes
5answers
2k views

Generating CSV strings for various 3rd party utilities

I'm generating CSV strings for various 3rd party utilities and this section of code gets repeated in many classes. Is there a better way to generate this string? ...
34
votes
11answers
3k views

Too many loops in Drawing App

I have a method that has a lot of loops: ...

1
192 193 194 195
196