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

0
votes
4answers
179 views

How to mark/track features in code?

After some time in every project sooner or later you will need to find a feature in it a fix it or extend it so I was wondering if there is already a system or a convention for marking those features ...
4
votes
3answers
2k views

Separation of retrieving data and business objects between DAL and BLL Layers

I did some research before posting this question. Among other questions or post, one of those is provided below. I could not get a clear mind how to determine.. Business Objects within a Data Access ...
-3
votes
0answers
36 views

Question about video format when developing an online video streaming/editing application [on hold]

I'm going to develop an online video website with a built-in video editor using ASP.NET. In the requirements, my application both supports video streaming and editing on the Internet, and the user can ...
-5
votes
0answers
34 views

Make VS copy and paste code using some kind of attribute [migrated]

I am using VS 2015 and C# I tried to search for it but I don't know what terms to use... What I want to do is to mark part of my code with compiler special attribute or something and then go to ...
-5
votes
0answers
45 views

Program described in a single sentence [on hold]

I'm a brand new programmer studying C# as my first language of choice. I'm still trying to wrap my brain around the process of programming, so I would like to describe the scope of a program and it's ...
5
votes
1answer
201 views

Why does this shared buffer work?

Background The following code snippet is taken from a problem in, Visual C# 2005: How to Program, by Paul and Harvey Deitel (pp. 735). The code snippet is more or less an application for accessing ...
7
votes
5answers
185 views

Open Closed principle in design patterns

I am bit confused about how Open Closed principle can be applied in real life. Requirement in any business changes over the time. According to Open-Closed principle you should extend the class instead ...
0
votes
0answers
30 views

Suggestions for dataloading - semi dynamic data

I have a very old Perl based system that is used for CAD drawing searches, where each drawing has many metadata fields associated with it. Currently, the 'old' system has a database schema that has ...
2
votes
0answers
145 views

Dictionary of dictionaries design in C#

My question: is there a canonical way of creating a dictionary of dictionaries and providing an outer/inner key pair? Is there a NugetPackage out there with an implementation? In my code, I have now ...
13
votes
7answers
1k views

Does C# experience translate well to C++? [closed]

My programming classes in school were C++, but I ended up working a job doing C# for the last few years. If there was a position that required say 1 or 2 years experience in C++, would my experience ...
4
votes
1answer
260 views

Managing resource paths in source code

I suspect this is something that many of you have dealt with, and I'm certain there's articles on how to do it, but I can't seem to find them. My problem is that my various constant classes in Java ...
10
votes
5answers
314 views

Is indiscriminately catching exceptions (Pokemon exception handling) ever acceptable? [duplicate]

Normally, I don't anticipate exceptions and if I get them, its something that I can't fix in my code - bad user input or connectivity issues with the database. But errors do occur so at the very ...
5
votes
4answers
187 views

Does anyone have a good DI registration pattern?

I've done this so many times but I never end up liking how my code turns out. I'm asking if anyone else has the same problems and can offer solutions or conventions that they've used to make cleaner ...
0
votes
1answer
94 views

Recommended approach to initialize Command

I've two commands in my View Model and one of them is initialized using lazy loading and other using eager loading. Which approach is good to go? Should I use lazy loading or eager for both? View ...
0
votes
0answers
11 views

Default Application Compatibilty Manifest for new Visual-Studio projects? [migrated]

I'm currently fighting with some app compat settings, specifically a certain shim, and looking into the compatibilty section of the application manifest. Details aside, one thing that strikes me as ...
-2
votes
0answers
99 views

How to rate your programming skills [closed]

I am an Electrical Electronic Engineering student and I started programming 2 years ago. I am about to graduate from University and I cant tell how skillful I am in programming. I have written a ...
-4
votes
0answers
51 views

What will be approach for below mentioned scenario in C#/Dot Net World [closed]

Scenario Mentioned: We are having central module/service, where each client sends requests to CM/CS and central module/service forwards the request to the appropriate window pricing services like ...
-1
votes
0answers
20 views

PropertyGrid color cell display [closed]

Is it possible to change the default way to display a color in a property? I want to use the color as a traffic light to display working conditions with three possible values: Red, Yellow and Green. ...
-4
votes
2answers
70 views

Referencing a C++ DLL from within a C# ASP.NET project using Visual Studio Community 2015 [closed]

This question might be a little odd, but is there any specific way to import a C++ reference into an ASP.NET C# project? The problem I am having is that VS is giving me the following error: ...
-2
votes
2answers
168 views

OOP project design

here is the UML class diagram subscribe method is used to add a herbivore object to the plant's watchers. when a plant is told to notify, itloops through all of the herbivore object in its watchers ...
1
vote
1answer
100 views

Using ninject in a class library

Looking for some help getting my head around ninject and DI. Using the simple examples I've found online everything works nicely but trying to do something more complex is causing headaches. I have ...
0
votes
1answer
159 views

Is there an easier way to do this with Lazy<T>?

I was trying to find a concrete example online but I couldn't find one that also used one of the class' other attributes. So, can this be done more succinctly with a Lazy<T> object? public ...
2
votes
2answers
77 views

What is the best approach to update a database field when a corresponding class property changes?

I have a class with several fields. public readonly byte Id; public bool Active { get; set; } public List<Group> Groups { get; set; } public ...
5
votes
2answers
118 views

Recreating complex aggregates from a persistance source

I'm building a web application with C#, and I have an aggregate root which has several entities and value objects. Then I have a repository object which persists the aggregate to the database (I'm ...
1
vote
5answers
9k views

How to Console.WriteLine from [TestMethod]?

I am trying to show some information from a [TestMethod] method. Usually we use NUnit and a line with Console.WriteLine runs fine and we can see it in 'output' window, but on this project we must to ...
-3
votes
2answers
157 views

Can a media decoder/player be implemented entirely in C#? [closed]

One of these days, when talking to a friend about different programming languages and their uses, I mentioned that video players (and media coding implementations) are always written in lower-level ...
2
votes
4answers
145 views

Unit Test for Void which copies data from one location to another

Still learning and getting my head around Unit Testing, (also trying to get into TDD, though I appreciate it isn't the same thing) and in many ways it is changing/improving my code. But I come across ...
4
votes
2answers
192 views

Name for a Chainable ForEach [closed]

Linq has a method Select, which takes a Func<TIn, TOut> and maps it over an iterable. I'm trying to come up with a good name for a method that takes an Action <TIn>, transforms it to ...
1
vote
1answer
56 views

Asynchronous client-server implementation

The mission: Implement a program that will listen to multiple client requests asynchronously (on TCP) and transfer them to a server (also on TCP) to which only one connection is allowed. The program ...
1
vote
2answers
121 views

How should I represent mutable boolean state?

When I have some object with boolean state that can be changed (like a checkbox's checkedness), there are several ways I can expose it. Getter property, Setter method bool IsChecked { get { ... } } ...
0
votes
3answers
157 views

Is data duplication bad in programming (in contrast to database designing)?

I have three classes: User, Conversation and Message: Message properties: User sender; // Some more Conversation properties: List<Message> messages; List<User> participants; // Some ...
2
votes
2answers
109 views

Should we add an extra class to this code sample

I have a shopping website which allows users to place orders. In my web application when the users click 'Create Order' i call an OrderService class which looks like the below: public class ...
-1
votes
1answer
42 views

C# asp.net mvc Entity Framework migrations [closed]

What are the pros and cons of using Entity Framework data migrations? I have never done this professionally but I see many tutorials that advocate this. The example I saw for core.net ef 7 shows code ...
2
votes
2answers
130 views

C#/VB struct – how to avoid case with zero default values, which is considered invalid for given structure?

How to implement some constrained .NET struct/structure (let's say LimitedString), where its state with default values (set by CLR to technical defaults, i.e. nulls, zeros, etc.) should be prohibited ...
4
votes
1answer
114 views

Have the unit test “using” the project, or just have same namespace?

Background I am working on a project with C# .NET, and I've just added a new unit test project to my solution in Visual Studio. The way that I always have been doing this is: Create a new unit test ...
5
votes
1answer
860 views

How do I bootstrap a P2P service so that users can locate each other?

My P2P app needs to locate peers, but I don't want to hard-code a DNS address... One example I've seen is bootstrapping via IRC, but I'd like to do this over HTTP/s if possible. What are my options ...
0
votes
2answers
232 views

Don't auto-implemented properties violate encapsulation?

In C#, when a field getting or setting requires logic, we use properties. For example: private int _age; public int Age { get { Console.Writeline("Club member is {0} years old", ...
7
votes
4answers
207 views

Code design: Duplicate code or good implementation

I'm working on application in C#, where I need to serialize and deserialize some classes into/from XML. This operations will be implemented in Class Library. I chose XMLSerialization class to ...
3
votes
2answers
136 views

Correct way for storing data for runtime use in stand-alone applications?

I am working on a project that involves a "team builder" type application, if you will using C#. For the sake of simplicity, let us say it involves the user creating a "Team." There are three teams ...
2
votes
1answer
155 views

Pattern to use (if any) to co-ordinate loosely coupled classes with strong interdependencies

I have a collection of cooperative classes whose behaviors are interdependent upon one another. But I wish to keep them loosely coupled, so I've created appropriate interfaces. I want to determine an ...
1
vote
1answer
216 views

Modular Filter Architecture for WPF

I am creating a little stock-management tool for private use. I have different views, which need similar but different filters. As an example I have a "current stock" list where I can filter for ...
4
votes
2answers
236 views

Why is an abstract class forced to define all functions of an inherited interface?

Why does c# compiler force an abstract class to define (as opposed to implement) all the methods of the inherited interface ? why does it not mark unimplemented methods of an inherited interface as ...
6
votes
2answers
351 views

Is there any reason to use a Func over a method?

I recently just started looking at Func in C#, and as far as I can tell, they pretty much are the same as methods, which is fair enough. However, I was wondering if there is any point in using them, ...
9
votes
2answers
3k views

Choosing the right Design Pattern

I've always recognized the importance of utilizing design patterns. I'm curious as to how other developers go about choosing the most appropriate one. Do you use a series of characteristics (like a ...
4
votes
1answer
229 views

Is there a term used for the collection of a key and value in a C# dictionary?

simple question, I want to know if there's a word/term used to describe the collection/pair of a key and value in a C# Dictionary.
7
votes
3answers
215 views

Using Interfaces for Loosely Coupled Code

Background I have a project that depends on the usage of a certain type of hardware device, while it doesn't really matter who makes that hardware device as long as it does what I need it to do. With ...
0
votes
1answer
54 views

One time use token Mobile / Desktop linking. How to?

I want to know if there's a way or known way to implement this: Lets say I have: a C# WinForms program a Javascript Mobile Application (Android / iOS) What I want to do is: for my C# ...
2
votes
1answer
409 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 ...
1
vote
2answers
39 views

Printed Page layout application with images in C#

I'm working on an application to help create printed-page layouts (to be then fed into a custom script for InDesign). I'm facing a problem regarding placing images on a page. Either a single image ...
3
votes
1answer
100 views

How do I Balance Multiple Service Contracts with Duplicate Structures

My current task requires me to use a set of web service calls to a 3rd party vendor in order to retrieve and update information. The objects used in these calls - namely the response from a get and ...