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

1
vote
1answer
88 views

Database choice [closed]

I am working on a system where I am replacing and existing Cobol system with C#. For the database I have hit some requirement which I am having a hard time to find complete support for (tried SQLite ...
0
votes
1answer
74 views

String sentence consistency when sent over sockets

I am learning socket programming. I have a Java application as my server, and C# for the client. Just sending string lines from one to another. Below I have code snippets showing how I am currently ...
3
votes
3answers
198 views

Should I denote that a method satisfies an interface?

When writing a class which has ("satisfies") 1 or more interfaces, should I note somehow (e.g. in an XML comment, or with an attribute) that a particular method was added for one of the interfaces? ...
2
votes
1answer
87 views

Do I need EventAggregator here?

I'm learning MVVM pattern with C#, WPF and .NET Framework 4.5.1. I'm using MVVM Light framework to do it and now I have a doubt. Reading the book Windows 8 MVVM Patterns Revealed I see that the ...
1
vote
1answer
166 views

What kind of game mechanics makes sense to be handled on client side? [closed]

I am aware of that is a difficult question and depends on the game mechanics and game type being applied. So, many answers can be given. For the sake of simplicity, it would be better to consider a ...
2
votes
2answers
462 views

Is there a name to this coding practice shown in the example? [closed]

Take a timer in your hands, then have a look to the following code. What is it doing? foreach (var summaryOdd in odds) { var category = new PlacedCategory(); var eventId = ...
1
vote
1answer
69 views

Converting from AppHarbor to Azure

I'm thinking of switching my cloud provider from AppHarbor to Azure. Main reason, I love the ability of being able to scale up the number of workers as traffic/cpu usage gets really high. My question ...
3
votes
2answers
805 views

Should an ASP.NET MVC application directly use Entity Framework as the model?

I'm building my first MVC application in Visual Studio 2013 (MVC 5) and I'm a bit unclear on the best way to setup my model. I've generated an entity framework model using code-first from an existing ...
3
votes
3answers
270 views

Method waits for user action

I have a structural problem for an application I'm working on. In the interest of full disclosure, it is for a university assignment so I'm not looking for you to code me an answer, just help me ...
0
votes
2answers
51 views

Hub which executes interface methods on all registered onstances

Is it possible to have generic class (let's name it Hub), which implements interface T. And now I can use a method named Add (not a part or interface T) on this class. And Add methods allows me to add ...
-3
votes
1answer
97 views

Automating daily procedures [closed]

Is there a way to automate running VBA in Excel to clean up the file from inside an application? Everyday my office has to confirm that 50 people have shown up for work on time. The scheduling ...
-2
votes
2answers
152 views

In C#, can I do “this = …” outside of a constructor? [closed]

Basically, can I do this, and what actually happens? public class foo { public int id; public void bar() { //do stuff this = null; // ? //do stuff ...
0
votes
2answers
112 views

Unit Testing large controller actions

I've a web page that has many constituent parts. On some user action, a POST operation is made, which then returns JSON to update the page. The problem is that this JSON payload contains a lot of ...
0
votes
0answers
141 views

Evaluating local storage for data persistence for small, stand-alone applications

TL;DR - I have a standalone application that will remain relatively small. I'm trying to evaluate between using XML files or a lightweight database for local storage of data that needs to be ...
0
votes
4answers
369 views

which pattern is most intuitive for a calculator app?

The title says it all. I'm trying to build a calculator application (for self-learning purposes). The application is going to have a very common UI, with plus(+), minus(-), multiply(*) and a divide(/) ...
-2
votes
1answer
167 views

How to access client application (Scanner or .exe) which are installed on client machine using Asp.net web application [closed]

How to access client application (Scanner or .exe) which are installed on client machine using Asp.net web application? I want to Access Scanner which are installed on client machine. I'm using a ...
0
votes
2answers
165 views

Is there a way to sort code properly into regions dividing methods and events? [closed]

I'm using ReSharper and CodeMaid, both have their own "organize" code option but the problem is that i have no idea how to tell them what is an event and what is a method/function that i coded. If i ...
3
votes
1answer
369 views

MVC: Where is the right place to set error messages?

I have a ASP.NET MVC application where in all my Models have an Errors Property used to store non-validation errors which I than display in my Views. Where is the right place to populate the error ...
-3
votes
1answer
57 views

Distinct Log and Trace for each object in .NET [closed]

I am dealing with very complex objects in .NET (in my case a finite element model that can consist of thousands of other objects say a Model instance have a large list of Element instance). I would ...
1
vote
0answers
133 views

Separation of concerns between repository and service in DDD with complex entities

This probably seems as an example of opinion-based question, but I'm actually looking for rationale on how to decide correctly, I believe there is a correct solution that can be backed by solid ...
2
votes
2answers
149 views

How do I write my BLL to make it re-usable?

Most of it was written 4-5 years ago. Our teams long term objectives are to use Entity Framework. Though we aren't gonna do it right away as our deadlines aren't allowing us to do so. Now we have our ...
0
votes
2answers
157 views

Is this instance of mixing FP and OOP a good design?

I had a strange-feeling pattern come up in some code I was writing. In a project with user accounts, there was a lot of code that needed to do common things such as creating accounts, deleting them, ...
6
votes
3answers
786 views

How to unit test code that downloads a file from a github repo

This is my solution's structure: Storage.csproj > FileDownloader.cs > GitHubProvider.cs (implements IStorageProvider) > IStorageProvider.cs Storage.Test.csproj > ...
14
votes
3answers
653 views

I get dependency injection, but can someone help me understand the need for an IoC container?

I apologize if this seems like yet another repeat of the question, but every time I find an article regarding the topic, it mostly just talks about what DI is. So, I get DI, but I'm trying to ...
0
votes
1answer
91 views

LDAP users synchronization [closed]

I'm looking for a way to synchronize a users database between a piece of software and a ldap directory. Currently I'm thinking of three possibilities to keep the track of a specific user : Guid : it ...
1
vote
4answers
372 views

When to not use dynamic in C# [closed]

I'm making a class similar to the following: public class KeyValue { public readonly string key; public readonly object value; } Value could be of any object type as a result of this ...
1
vote
2answers
170 views

Where to put database table/column names?

I'm making a web app that will be querying an existing database. I'm thinking of putting the names of the tables and columns and such into a single static class, and then referencing that when ...
2
votes
1answer
170 views

What are the motivations behind making true and false overloadable operators?

I asked this question on Stack Overflow and it was met with negative reception. I figured that Stack Overflow wasn't the right place to ask this question, so I decided to post it here. Beside making ...
0
votes
0answers
172 views

how to use Sql query to search text in CSV file and avoid iteration

I have one A File and many input files ,All files have CSV format . I want to match text of one column of all input files with one of the column of A file . I have stored all column value of File A in ...
0
votes
2answers
149 views

How are the tiles in WORDAMENT organized?

I'm trying to create a word game, just like WORDAMENT, in my spare time. In order to present a new round, I need to create a board with 16 letters organized in a 4*4 grid. Currently, I'm generating ...
0
votes
3answers
90 views

Are EventHandler<T> and IObservable<T> interchangable?

I have an object which will periodically raise an event based on an action performed in an application. This will be heard by any listener(s) and acted upon accordingly. I do not wish to use a ...
3
votes
4answers
286 views

Is a long list of parameter checks an anti-pattern?

Background: I'm working on an application that will manage backup generators. These generators need to be able to be "linked" together. For example, Generator B might serve as a backup for ...
-1
votes
2answers
103 views

Class hierarchy question - do you implement separate classes for the same behavior? [closed]

NOTE: The language I am using is C#. I am currently working on a 'The Quest' mingame where there is a player and some enemies. My design so far involves a base abstract class called 'Mover' and an ...
1
vote
3answers
250 views

How do you make sure a .net client application is not being hacked to bypass authorization claims?

We wrote a simple .NET (C#) desktop application in Wpf. We also used WIF (Windows Identity Framework) to get a list of claims for the authenticated user. Some examples are: CanOverrideSalesAmount ...
1
vote
2answers
387 views

Is this a good Visual Studio solution structure for a domain driven design RESTful web service?

I am building a .NET 4.5 C# Web API RESTful solution and I would like someone to tell me if my project solution is correct and/or wise(-enough?) for a solution designed using Domain Driven Design, ...
1
vote
1answer
271 views

Understanding C# Delegates Structure

I've been trying to understand C# delegates using Pro C# 5. In short, the author describes the motivation for delegates as a structured way of dealing with function pointers and callbacks or two-way ...
2
votes
2answers
127 views

What is the benefit of passing a delegate to the constructor instead of just having the client code create and pass the ParserSettings?

When answering a question on Stack Overflow, the library appeared to have a weird way to specify configuration, through an Action passed to the constructor: public Parser(Action<ParserSettings> ...
1
vote
1answer
143 views

Should the Presenter depend on the View or the vice versa?

So far, I have used the MVP architecture pattern a few times. Every now and then, I wonder whether my Presenter should depend on my View or vice versa, that is the View depends on my Presenter. NOTE ...
0
votes
2answers
191 views

Custom Video Player

I have a custom file type .mft which is basically a zip that has video inside (mpg,mp4,etc) that is encrypted/protected. My ideia is to create a custom video player which will read those .mft files, ...
0
votes
5answers
363 views

Liskov Substitution and SRP Principle violation - how best to structure this scenario?

While learning SRP and LSP, I'm trying to improve the design of my code to comply best with both of these principles. I have an employee class that has a calculatePay method on it. Firstly, I believe ...
4
votes
3answers
475 views

Intentionally incorrect use of language features, specifically “ref” in C#, as a hint to colleagues

I recently came across a piece of code something like this (roughly C#): public bool ValidateStuff(ref ArrayList listOfErrors, Stuff thingsToValidate) { if (!thingsToValidate.isValid() ) { ...
4
votes
1answer
265 views

Repository Pattern: Exposing Data Context to Underlying Layers

My team is in the process of updating a legacy project. We've decided to incorporate the Repository Pattern along with Entity Framework in our Data Access layer. Below is a high-level view of this ...
1
vote
1answer
494 views

What are the benefits of using entity framework code-first instead of designing my database using SQL?

I'm currently working on designing a small web application (MVC5) and I'm to the point of designing my database. I have the schema I want worked out and I am quite proficient in SQL Server. (I have my ...
2
votes
1answer
224 views

Any OOP design pattern that is somewhat representative of all of the SOLID OOP design principles at play?

I'm trying to teach an object oriented design principles course (on SOLID) at a training institute. I also want to teach the students a few OOP design patterns such as factory, singleton and one ...
2
votes
1answer
185 views

Fire domain events after transaction completes

I am trying to implement a domain event system that only fires its events when the associated unit-of-work commits successfully. The main reason why I want to do this is because I have other ...
2
votes
2answers
157 views

Data persistence for transactional customer emails

I'm developing a system to handle sending transactional emails to our customers. This is how it works: An event occurs during the order's life cycle, for example 'shipped' This event will trigger ...
0
votes
1answer
173 views

Knowing who is the user in every request (every action, every view, every time)

I have many model classes that are mapped from/to tables using EF. Two of them are User and UserCookie, which are stored in tables Users and UserCookies. public class User { public long UserId { ...
0
votes
0answers
190 views

Login from external application in MVC

We have an ASP.Net MVC application that use Identity provider to authenticate users. A new customer now wants to access owr application pressing a button inside their winform app. I started to modify ...
2
votes
1answer
241 views

Is there a design pattern for splitting up files into smaller files?

I am developing a project where I have to load very large files (upto 50 MB). Currently I am loading these files completely into (consecutive) memory. This has the advantage that I can very easily ...
0
votes
2answers
78 views

Possible design patterns for base function with possible additions

I have various interfaces i have to implement. Let's assume ITypeA, ITypeB. They have following methods: ITypeA Connect Disconnect GetData SetData ClearData ITypeB Connect Disconnect ...