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

7
votes
3answers
208 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 ...
15
votes
5answers
2k views

IOC Containers break OOP Principles

What is the purpose of IOC Containers? The combined reasons for it can be simplified to the following: When using OOP/SOLID Development principles, Dependency Injection gets messy. Either you have ...
0
votes
1answer
223 views

Application use on website

Is there a good way to run a C# application on clientside in lieu of JavaScript? I have done some front end work with JavaScript and backend C# for web developing at an old job, but I am interested in ...
1
vote
0answers
64 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
1answer
75 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, ...
1
vote
2answers
443 views

Correct way to inject dependencies in Business logic service?

Currently the structure of my application is as below Web App --> WCF Service (just a facade) --> Business Logic Services --> Repository -> Entity Framework Datacontext Now each of my Business logic ...
5
votes
3answers
589 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 > ...
0
votes
1answer
51 views

LDAP users synchronization [on hold]

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 ...
-3
votes
0answers
32 views

VS or ReSharper shortcut for collapsing properties to one line? [on hold]

I often find myself collapsing properties written like this: public int A { get { return this.B + this.C; // or some other simple expression } } To something like this: public ...
8
votes
4answers
1k views

What are the consequences of having unnecessary references and usings?

I'm a bit of a neat freak and tend to keep my projects by cleaning references and usings in each class to keep only what's actually used. What other argument could I make (besides calming my OCD ...
1
vote
1answer
235 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 ...
1
vote
4answers
279 views

When to not use dynamic in C# [on hold]

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 ...
-3
votes
0answers
47 views

Want to add Another loop in while Condition [on hold]

I am having difficulty in writing code public void Func(string[] Abc) { string value=GetValue(); While(any string in Abc[] contains value) { value=GetValue(); } } the ...
0
votes
0answers
107 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 ...
1
vote
2answers
136 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 ...
4
votes
3answers
390 views
+100

Implementing a generic/dynamic custom property system in C#

I have an architecture design problem which I think is appropriate for this site. Note that I have made an EDIT to this post below, reflecting my latest potential solution to this problem. General ...
0
votes
2answers
855 views

Creating a websocket server on Linux

I want to create a websocket server and I've found a great article here. However C# will output an exe file. I'd like to have it run on a linux box. What I want to do is to connect to the server, and ...
1
vote
4answers
242 views

Relative encapsulation design

Let's say I am doing a 2D application with the following design: There is the Level object that manages the world, and there are world objects which are entities inside the Level object. A world ...
2
votes
1answer
155 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
2answers
138 views

Organizing solution / project structure and classes for Line of Business Application (LOB)

The question how-do-you-organize-your-projects already has a few good answers. I would like to get a better understanding about this suggested structure: MyApp.Core MyApp.Model MyApp.Presenter ...
-3
votes
2answers
680 views

A small project but I want to use design patterns to do it right [on hold]

I've got a project coming up, a very a small system, but one that needs to be extended in the future. Here's how I've designed it so far. It's 3-tier: presentation, business and data. For the ...
-4
votes
0answers
48 views

parameterized query… unexpected in database using C# [migrated]

Hello there I am trying to enter database records from window Form design and programmed using MS visual C# and it approved and entered database using an other Window Form and I call the child Form ...
1
vote
1answer
165 views

Passing in config values to a method using SOLID principles

I have an email helper class that has a method that sends email: private static class EmailHelper { public static void SendEmail(string from, string to, string subject, string message) { ...
0
votes
1answer
67 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
1answer
279 views

Tree View Children condition indicator on topmost un-expanded parent

I am using a tree view in c# and i am creating custom icons for the nodes. Let say this is my hierarchy with a node that satisfies a certain condition: Root1 |_Ax |_Bx1 |_Bx2 |_Cx1 ...
-2
votes
1answer
52 views

Effects of using visual basic dll in C# projects [on hold]

I have C# windows application that use Microsoft.VisualBasic.dll reference for the needed of use Interaction.InputBox is that have any negative effects on the project ?
10
votes
4answers
340 views

Purposely raising exceptions to use catch

For a typical if...else wrapped with exception handling, is something like the following example a recommended practice to avoid code duplication? try { if (GetDataFromServer()) { ...
3
votes
4answers
261 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 ...
12
votes
3answers
4k views

async+await == sync?

Stumbled upon this post that talks about making async web requests. Now simplicity aside, if in real world, all you do is make an async request and wait for it in the very next line, isn't that the ...
0
votes
2answers
150 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
3answers
79 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 ...
0
votes
2answers
417 views

How I could update a DB table using a POCO class bound in a DataGridView

I try to explain better using an example: I create the class Product with attibutes like that: private string _ProductCode = ""; [DisplayName("ProductCode")] public String ProductCode { get { ...
-1
votes
0answers
70 views

How to identify hackers based on ip addresses and the pages that were accessed [migrated]

I saw some suspicious errors being generated on my site based on pages that were requested. My error is logging the path that the user is trying to access. Because of these errors (and the paths that ...
8
votes
2answers
398 views

Property proper naming to represent string starting with number

Looking at some camera metadata on Windows File Properties there are (along with a few more) two Properties named Focal length and 35mm focal length. I'm developing software that will make use of ...
4
votes
3answers
460 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() ) { ...
-1
votes
2answers
73 views

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

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 ...
0
votes
0answers
66 views

C# Linq question [migrated]

I am desperately trying to understand linq and now I have a concrete example of what I want to do (and fail): Console.WriteLine("{0}", (from myaddresses[x].PostalNr where x => ...
7
votes
1answer
4k views

Learning C# quickly

I just got a position at a big, well-known C#/.NET company. The thing is that I don't know any C# or .NET at all (they know that) and I want to learn as much as I can before I start, to not waste time ...
0
votes
0answers
97 views

How can I write the code to get all the properties of a class? [migrated]

I have a program, where I want to create a new instance of the object depending on a value, I take the value and then search the list and using that list I create a new instance. Well, it goes ...
1
vote
3answers
290 views

Gathering IP address and workstation information; does it belong in a state class?

I'm writing an enterprisey utility that collects exception information and writes to the Windows Event Log, sends an email, etc. This utility class will be used by all applications in the corporation: ...
-2
votes
0answers
75 views

How to plan development [closed]

I am a self-taught 17 year old who knows Java and C# as well as I can, be learning them for over a year but I have never coded anything so therefor no experience.Me and my friend are working together ...
6
votes
6answers
1k views

Adding to the System namespace in C#

Would it be acceptable for some very generic utilities or classes to be added in the System namespace? I'm thinking of really basic stuff like a generic EventArgs (EventArgs<T>), Use case: ...
1
vote
3answers
208 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
162 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
117 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
1answer
136 views

Time Management System on Local PCs [closed]

I am looking to build a time management "app" that can be downloaded and used on an individual basis throughout my company. In theory, this app would be used to track time spent on several different ...
81
votes
11answers
21k views

What backs up the claim that C++ can be faster than a JVM or CLR with JIT? [closed]

A reoccurring theme on SE I've noticed in many questions is the ongoing argument that C++ is faster and/or more efficient than higher level languages like Java. The counter-argument is that modern JVM ...
0
votes
5answers
340 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 ...
1
vote
1answer
172 views

Clarification about Event Producer in StreamInsight

I need a small clarification about streamInsight, I know by doc's that StreamInsight can handle multiple concurrent Events. But will the event producer be a separate function, for ex: I need to watch ...
2
votes
2answers
104 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> ...