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

-4
votes
0answers
28 views

How to select a folder in treeview? [on hold]

I want to select a folder from treeview(that is in a popup windows) and click on select button to append every file in that to a listview. How to I can do this? My website is with Asp.net and c#.
2
votes
2answers
34 views

Relating an array of objects to an enumerator

How would you relate the indexes of an array to an enumerator without leaving the chance of mismatch? Example public enum difficulties { easy, medium, hard } public List<Lobby> ...
2
votes
1answer
133 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 ...
6
votes
2answers
117 views

Is creating a new List to modify a collection in a for each loop a design flaw?

I recently ran in to this common invalid operation Collection was modified in C#, and while I understand it fully, it seems to be such a common problem (google, about 300k results!). But it also seems ...
1
vote
3answers
71 views

C#6: Should I refactor my code using Resharper for the new features? [on hold]

C# 6 is here for a while now and brings with it some syntactic sugar that Resharper is kind enough to highlight and recommend that I "migrate to". Should I apply these fixes automatically to the ...
2
votes
2answers
378 views

Moving old desktop application to a robust platform [closed]

Several years ago I wrote a desktop application, a small accounting system, in Delphi 7, that is in user in a medium-sized company. The code belongs to me. I ported another Accounting system that I ...
2
votes
1answer
1k 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 ...
7
votes
6answers
17k views

What's the point of passing a parameter by reference in C#? [duplicate]

Possible Duplicate: Why are objects passed by reference? Doesn't C# send the objects themselves? So unless it's some kind of swap function for primitive typed variables - why would I send ...
33
votes
11answers
14k views

Is catching general exceptions really a bad thing?

I typically agree with most code analysis warnings, and I try to adhere to them. However, I'm having a harder time with this one: CA1031: Do not catch general exception types I understand the ...
-2
votes
0answers
47 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 ...
4
votes
4answers
231 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 ...
19
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.
3
votes
2answers
309 views

Integration testing and database connection string in app.config

I am working on a project where SqlConnection is created via a static method, lets say it's DatabaseAccess.GetSqlConnection(). This method reads the .config file to get the connection string and ...
2
votes
1answer
120 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 ...
41
votes
13answers
10k views

Why are /// comment blocks important? [on hold]

Someone once said we should prefix all our methods with the /// <summary> comment blocks (C#) and I am wondering if that is true or not. I started to use them and found they annoyed me quite a ...
1
vote
2answers
322 views

Strategy for creating a websocket relay?

I own a Raspberry Pi and would like to use it as some sort of websocket relay, so that all people who visit a specific webpage would be able to communicate with each other. The key thing about this is ...
1
vote
0answers
104 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
2answers
199 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 ...
2
votes
0answers
62 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 ...
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; } ...
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 ...
2
votes
3answers
284 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 ...
1
vote
1answer
76 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 ...
2
votes
4answers
233 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 ...
5
votes
1answer
331 views

Token or ASP.NET Identity based security in ASP.NET Web API 2

Background I have a Web API 2 project, without any extension of ASP.NET MVC or ASP.NET projects. The API will only be used to communicate between the server and Windows 8, Windows Phone 8.1 and iOS ...
3
votes
1answer
177 views

What does “Stateful” means in Stateful ViewModel in MVVM

I was reading about some XAML patterns, and there was the Stateful ViewModel, according to what I read it has nothing different than what we as just the "ViewModel". Here's a description for example ...
1
vote
1answer
540 views

C#/.NET multithreaded application design

The application to be designed serves as a bridge between two different systems. One natively speaks TCP (RS232 actually, but there's a COM->ETH server in the line of communication) - the other one is ...
1
vote
3answers
113 views

Abstracton layer to control services access to denormalized db entity

Our db is optimized for minimum join count (partially denormalized). E.g. our User entity contains account data (nickname, facebook id, etc), user numerical statistics (total games played, total wins, ...
9
votes
3answers
8k views

How do I traverse a tree without using recursion?

I have a very large in memory node tree and need to traverse the tree. Passing the returned values of each child node to their parent node. This has to be done until all the nodes have their data ...
2
votes
1answer
127 views

Managing Massive Updates with Resource Access

I have a number of data servers that are pushing data to a main server as in this kind of architecture: These data points (points for short) are updated randomly from each server. On the server, ...
1
vote
0answers
43 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 ...
1
vote
2answers
108 views

Issues deciding on approach to create object

I'm trying to decide what's the best approach to instantiate a particular class. Basically there are two use cases for it: instantiate it in order to save a new entry to the database and fetch an ...
1
vote
1answer
764 views

Data transfer between “main” site and secured virtual subsite

I am currently working on a C# ASP.Net 3.5 website I wrote some years ago which consists of a "main" public site, and a sub-site which is our customer management application, using forms-based ...
3
votes
1answer
597 views

Clustering Strings on the basis of Common Substrings

I have around 10000+ strings and have to identify and group all the strings which looks similar(I base the similarity on the number of common words between any two give strings). The more number of ...
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 ...
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
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 ...
1
vote
1answer
312 views

Questions about the issue of getting stuck in a problem, and making snail's pace progress [closed]

Let me describe my background. I am currently a software developer co-op working at an architecture firm that has a large focus on research and development, mainly in mathematical modeling and ...
3
votes
1answer
275 views

specification regarding a text file

I have a specification I need to follow (for a little project) and I want to ask if they my way of thinking on how to tackle this spec is correct. It's regarding C#. Specification: consume a TEXT ...
2
votes
3answers
305 views

Accessing shared data without blocking in TPL

I am writing a class that contains data. It exposes methods that allow to query the data, while the data is also being updated from an external source (web service, for example). All the methods ...
5
votes
2answers
32k views

Generating a class dynamically from types that are fetched at runtime

Is it possible to do the following in C# (or in any other language)? I am fetching data from a database. At run time I can compute the number of columns and data types of the columns fetched. Next I ...
1
vote
4answers
2k views

Is there a downside to using AggressiveInlining on simple properties?

I bet I could answer that myself if I knew more about tools to analyze how C#/JIT behaves but since I don't, please bear with me asking. I have simple code like this : private SqlMetaData[] ...
0
votes
1answer
315 views

Organizing Business and Presentation entities

Background I am developing a WPF project. This is the basic structure: User Interface (WPF Project); Interfaces (class library, contains all the interfaces and the entities used by the ...
3
votes
1answer
80 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 ...
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 ...
13
votes
4answers
7k views

Why is there no WSDL type support for Web Api?

So I am just getting started with .Net WebApi and one thing that I am noticing straight away is that there is no Contract defining how the Api looks and should be consumed (Request/Responses from each ...
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 ...
3
votes
0answers
103 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 ...
0
votes
1answer
238 views

How can I decouple query and context in a “query object” scenario?

I'm using a query object pattern (similar to this) to manage disparate queries while avoiding bloaded facades/repositories. A query object takes a number of constructor parameters, representing query ...
3
votes
2answers
176 views

Async library guidance

I'm creating a library that contains a class that exposes several Async methods: public class MyClass { public async Task<Foo> DoFooAsync() { /*...*/ } public async Task<Bar> ...