C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.
0
votes
2answers
21 views
Interface of an authorization subsystem
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 ...
5
votes
1answer
14 views
How should I implement my domain model?
My domain model consists mostly of simple DTOs, i.e. 'Data Transfer Objects' which this article distinguishes from 'Plain Old C# Objects', like this one:
public class Settings
{
public bool ...
3
votes
1answer
32 views
Checking if vector is normalized
I tried to check if my vector struct is normalized, and I ended up with this code:
public bool IsNormalized
{
get
{
double len = Length; // Math.Sqrt ((X * X) + (Y * Y) + (Z * Z)); -- ...
9
votes
3answers
436 views
Reduce code complexity by applying ternary operator
I have a condition in my code where I need to put a lot of nested else if statements. However, I have managed to reduce some if cases by applying ternary operator, so that code looks nice and is ...
0
votes
0answers
20 views
cascading comboboxes in wpf data grid [on hold]
I am using combo boxes in data template column (not datagridcomboboxcolumn). In first column of datagrid. combobox should display countries and in second coloumn the combobox should display states. ...
0
votes
1answer
28 views
Displaying radio buttons more efficiently [on hold]
I have this:
private void TMobile_CheckedChanged(object sender, EventArgs e) { email = "tmomail.net"; }
private void Quest_CheckedChanged(object sender, EventArgs e) { email = "qwestmp.com"; }
...
6
votes
1answer
38 views
Are these the right type of unit tests to write?
Trying to get an understanding of proper unit testing, I've read up quite a bit and found myself writing tests like the ones that follow. Based on "best practices" etc., how am I doing as far as ...
0
votes
1answer
14 views
Consistent way to handle transient timeouts with WCF calls (timeouts, unreliable network, server load, etc)
I'm currently using the following code to manage calls to WCF services that are unreliable, and or suffer performance load issues due to contention.
Right now this code is limited to solving issue ...
3
votes
1answer
27 views
Lock-free producer/consumer implementation
I know of BlockingCollection in .net, but this is rather for my understanding of the pattern. Is this implementation correct ?
Consumer
class Consumer
{
readonly Queue<int> _q;
public ...
2
votes
2answers
26 views
Efficent way to Query a DB and write to text file - Large Recordset
I have a SQL query that returns a recordset with between 2 and 5 million records and I need to write that to a .csv file.
I wrote the following procedure and I'm curious to see if there is a better / ...
6
votes
2answers
83 views
Console-based menu system
Recently I started learning programming and I created this program. I've added something to it with every new lesson.
How is my code-writing? Do I make mistakes I shouldn't make?
The program itself
...
1
vote
1answer
29 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:
...
3
votes
1answer
20 views
Retrieving MAC addresses based on PCI interface connections and SQL queries
I am currently using this C# method to retrieve MAC addresses from a user's computer as a sort of unique identification. It retrieves the MAC address based on the fact that the physical card is ...
2
votes
0answers
20 views
Custom encoding for BinaryReader
I have a file that seems to mix encoding in it. It seems like a Unicode encoded file, but the character length string is encoded like a UTF8 or similar. Here is an example:
05 41 00 72 00 69 00 61 00 ...
5
votes
1answer
31 views
A generic way to use LINQ to Entity with types and operations unknown until run time
A question was asked here about reflection and LINQ to entity. I'm trying to modify the code that was presented to fit my needs, but it appears both Smeegs and Servy are quite a bit smarter than I am ...