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

learn more… | top users | synonyms

2
votes
0answers
57 views

Help understanding modeling in domain-driven design

I've been trying to learn domain-driven design (and similarly Onion Architecture) the last week or so. I think I've got an understanding of it, but like math, I suck at extracting all of the ...
-4
votes
0answers
76 views

Where to search for projects implemented with some framework [on hold]

I like reviewing projects from others implementing similar things that I have implemented. I program in c# and mostly applications that work with data. I often search on ...
-4
votes
0answers
16 views

Extract layers from existing PDF and add it as 1 by 1 [on hold]

I have PDF with 2 layer i.e. Layer1 and Layer2. I want to separate these two layer into two different new PDF file using itextsharp in c#. Input: Pdf file with Layer 1 and Layer 2 OutPut: PDF file 1 ...
17
votes
1answer
1k views

Why do arrays in .Net have Length but other collection types have Count? [on hold]

In C# for example, arrays have Length property. But other collection types like lists, etc. have Count property. Is there a reason why these two are different? If so I would like to know.
2
votes
1answer
115 views

C# try/finally for state cleanup

Is there any reason (for instance: performance) against moving state "cleanup" code in a finally state? Example: this.state.InProgress = true; // logic here this.state.InProgress = false; With ...
-2
votes
0answers
46 views

Builder Design Pattern : Accessing/Passing model data in/to Concrete classes [on hold]

First of all Sorry for question if its completely wrong, i am new to Design Patterns. I asked this question here also ...
2
votes
0answers
61 views

Seperate settings and implementation class hierarchies

We use XML serialization to store class settings. Each setting-class has (but doesn't reference) corresponding implementation-class. Therefore we can easily make a "settings dll" without any ...
1
vote
1answer
47 views

Does ReaderWriterLockSlim provide thread safety and speed efficiency (compared to a traditional lock) when using a List?

I have a list, to which I write once in every update Loop and then I spawn some tasks which create read that List and create a duplicate to manipulate that data. More or less it's List.ToList() call ...
1
vote
1answer
74 views

How to create a re-usable, command based messaging system

I am having trouble writing a simple command based system for a chatroom. I want users to be able to do chat actions such as /j myChatRoom or /join myChatRoom /w user12 Hello or /whisper user12 ...
4
votes
2answers
195 views

When is it appropriate to use expression bodied members? [on hold]

C# 6 introduces expression-bodied members, which allow for simplified code in methods and properties that only return the result of an expression: public override string ToString() { return ...
0
votes
0answers
91 views

Integrate C++ DLL with C# GUI asynchronously (design issue)

This is more a design than an implementation question. I am aware of how to integrate a C++ DLL within a C# main app that acts as GUI. Believe me that I've read all other questions on similar topics, ...
4
votes
4answers
226 views

Should an application configuration interface be broken into multiple interfaces to reduce feature creep?

My windows service is neatly separated into 5 components - each with their own interface and pulled together by a bootstrapper. One of my requirements is to provide configuration options in my ...
7
votes
6answers
2k views

How to implement a property on class A which refers to a property of a child object of class A

Not a very large architectual decision, but nevertheless I would value your opinion. We have this code (rest of the code is left out) public class Room { public Client Client { get; set; } ...
2
votes
4answers
224 views

Good practice for holding immutable data

I'm wondering what is the best practice for holding immutable data, more specifically in C#. For instance, lets say I have an immutable object called Foo. public sealed class Foo { public int ...
0
votes
0answers
39 views

Metrics for when to use a hash value?

I am working on a project that requires a series of flat files. I will be doing some data checking against simple date like: ID;StatusCode So a typical file might be like: 13993;R 38293;A 19349;I ...
2
votes
3answers
282 views

Why Session has implemented this way in Asp.net

I'm not a Asp.net/C# developer myself but recently had to slightly refactor a Asp.net/C# project and I had to use Session at some point. When working with the session, regardless of the data type that ...
0
votes
0answers
30 views

Naming conventions for services, factories, decorators and composites [closed]

When naming services I have seen some projects where the postfix Service is used sometimes and sometimes not within the same project. For example ProductService and PaymentProcessor. Do you have any ...
1
vote
1answer
79 views

Best approach to setting up test and production environments for a new project [closed]

We're a very small team of not very experienced programmers who just started a decently big project from scratch. We're using Visual Studio 2015, SQL Server 2008 and the Entity Framework. The company ...
3
votes
2answers
115 views

Should I use nhibernate for a one row settings table

I am using nhibernate in a quite big project. The system has a settings table which has 10 columns and one row, there is always a row and it should not be deleted only modified. Concurrency can be a ...
3
votes
2answers
184 views

Unit Testing without DI

I am starting a small ASP.NET MVC project, each task on the board must come with unit tests. The project is small, just a few pages with not that much processing, so I decided not to implement DI. My ...
3
votes
1answer
77 views

Implementing a requirement with a decorator and ensuring it's usage

In a shared library I have a function that is widely used. I'm implementing a requirement for the function to override it's behavior when the entities are in a specific state. I have decided on ...
3
votes
0answers
100 views

Domain Driven Design - DataServices vs Repositories for Domain Models vs Database Models [on hold]

I've been trying to refactor an old design in to an Onion Architecture in DDD style. To that point, the project went from a monolith to 4 sub-projects: /src /Project.Application /Services ...
2
votes
2answers
119 views

When should services persist data? [closed]

Is there a preferable way of when a service should persist data? Update Does this depend on if the services are public or internal? Some services take entity objects as parameters to do some action ...
2
votes
1answer
157 views

C# - design to parse and write csv and manipulating data [closed]

I've designed the below code for one of the requirement. I have to write different tests for the code and I would need feedback on where I can improve the design. Requirement: Read the customer ...
-4
votes
0answers
81 views

What so great about interface? [duplicate]

I am trying to dig in about "INTERFACES". So to understand I did a small demo in 2 ways. One with Interface and other without it. The result is same in both ways, the what is so great about interface. ...
0
votes
0answers
42 views

C# Implementation of Perl MD5->Digest method [migrated]

I have this code on Perl use Digest::MD5; use MIME::Base64; $ctx = Digest::MD5->new; $ctx->add('fredy'); print "Line $.: ", $ctx->clone->hexdigest, "\n"; print "Line $.: ", ...
4
votes
3answers
283 views

Functions whose parameters are implicitly supplied

Callback functions are able to accept some parameters, but they are not explicitly declared when calling the function. How does this actually work? What is going on that allows us to pass a function ...
5
votes
2answers
162 views

Should I have a separate XML settings file for my application?

I want to be able to add some objects to my application by simply adding a XML node to a config file. Should I put it in the app.config file or should I make a separate XML config file? A node would ...
2
votes
1answer
89 views

Thoughts on having a generic, reusable grid viewmodel

I'm developing a wpf-based application and I'm currently struggling to find the best way of supporting a recurring scenario in it. This app uses grids a lot. There are a bunch of features I want in ...
5
votes
1answer
180 views

How should I test the HTML output my class creates?

As a learning project, I am trying to create something similar to the WebGrid that comes with ASP.NET MVC. Now this component MyGrid<T> looks like this: public class MyGrid<T> where T : ...
0
votes
0answers
23 views

Microcontroller oLED Display Buffering Optimizations or Alternatives For Speed?

I'm developing a UI/Layout for a 128 x 64 oLED Monochrome Pixel Display. I've got a small netMF microcontroller driving the display via SPI at 40mhz. I'm using some basic methods, like these here, to ...
1
vote
3answers
321 views

How to design a class for a fixed-length id?

I'm building an app in C# that needs a fixed-length id, which is a string representation of a hex number. E.g. "0fa5" is an example of such an id of length 4. The length would not need to change ...
0
votes
0answers
57 views

Is using a self-hosted service a viable option for launching applications from a url?

We have a third party supplied application with a button that enables the opening of another application showing related data when pressed (these applications are made by completely different ...
3
votes
3answers
73 views

Determine frequency-range that matches closest to input list of frequencies

Since this question is not about "code not working", I'm asking my first question here instead of StackOverflow. Inform me if any required information is missing from the question. Setup: I ...
1
vote
1answer
355 views

Is it possible to avoid a lot of using statements?

Lets say I have a simple code like this (fiddleLink): using System; public class Program { public static void Main() { //Dependency register logic here var service = new ...
-2
votes
0answers
17 views

Webview rendering problems with c# XAML vb 2013 [migrated]

I'm trying to create a XAML app for windows tablet and for some reason it's not displaying (some) webpage correctly. It shows up fine when I try to access the erroneous webpage using Internet ...
1
vote
0answers
121 views

How to scale a C# server application

I'm writing a pretty simple TCP server/client application for the first time. It is a personal project for education, but I really like my applications to be extendable and to scale in case the code ...
0
votes
1answer
46 views

How to handle the default time when user is selecting dates to filter on?

We have an ASP.NET application which allows users to report on their data. We have a number of reports that the user selects the start and end date from a datepicker and then we returned the filtered ...
0
votes
1answer
51 views

Linking kernel voids without CPU parse (Compute shaders)

Is it possible to parse data between compute shader voids without having to create a new buffer and cpu link (Using unity with C# interface). For example I have a kernel with position data on a set ...
2
votes
2answers
234 views

Why does this use of IEnumerable, List, and Arrays seem to get modified when it shouldn't be?

I have started learning c# and am confused by the following feature. The following code uses a function Algs.Combinations(n,m) to produce an IEnumerable which contains the combinations of n objects ...
1
vote
1answer
171 views

Could a class with only auto properties could be a new language type and act like an interface?

Would it be useful define a type in C# that defines something similar to a data table so it can be instantiated but may not contain logic and also act as an interface? In addition I'm thinking this ...
1
vote
1answer
42 views

Is it safe to include connection data in token?

When generating a ClaimIdentity for use by oAuth in generating a token, is it safe to include database information as a claim? My application uses a different database depending on the specific ...
2
votes
2answers
104 views

Is there any reason to write delegates/events for one class?

I have a game with such events as GameOver, GameStart, PlayerWin, etc. I only have one class that is listening on these events, for the purpose of sending these events as TCP json messages to a client ...
2
votes
1answer
72 views

Class structure for Entity Framework

I'm using EF (Code first) and I'd like to isolate the properties from the methods (many of the methods reference other libraries that I don't want my database project to have to reference). As an ...
0
votes
1answer
72 views

Is it good practice to assign an instantiated class to a static property in the same class?

I have code that was written by someone else that goes like this: On a ViewModel: public static ACertainViewModel Default { get; private set; } On the same ViewModel's constructor: public ...
-1
votes
3answers
98 views

Integer conversion with Console.ReadLine() [closed]

To read an integer from user input, you can use: int number = Convert.ToInt32(Console.ReadLine()); But why won't the following work? int number = (int) Console.ReadLine(); What's the difference ...
0
votes
3answers
136 views

C# — Is there a key/key lookup table type provided in .NET?

It seems like a pretty straightforward thing to add, but I just want to be sure .NET doesn't already provide one and save me from adding unnecessary code: I need a lookup table (like a Dictionary) ...
1
vote
2answers
91 views

How do I write a proper messaging protocol?

I need to write a messaging protocol between client and server for a game application. I need to send messages back and forth such as, Player joined a game, player left game, player performed this ...
7
votes
3answers
338 views

Should I make my own exceptions, or co-opt similar exceptions for slightly non-standard purposes?

This is a general design question, but I'm focusing on C# and .NET because those are the languages I'm working with right now. Should I create my own, new exception classes, or co-opt existing ...
1
vote
1answer
147 views

C# Refactoring Code OOD and SOLID [closed]

I’m having some questions regarding improvement of code structure and maintainability, especially regarding SOLID. These questions are specifically for this project, so I would be happy if this ...