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
43 views

Is anything gained by making dependencies explicit via function argument lists when implementing pure methods?

This question is followup to this question. Is there any benefit in avoiding the 'this' operator when implementing pure methods? That is, are there any advantages to making all dependencies explicit ...
-1
votes
3answers
117 views

Why not make everything private or public? [on hold]

In code there are private and public declarations. Why shouldn't I make everything private or make everything public?
-2
votes
1answer
50 views

How to quickly work on a single class of a big GUI C# project?

So here's the problem. I have a massive C# project in Visual Studio. It has a big GUI that manages a large number of classes. In one of the form windows, there is a bunch of textboxes. The user fills ...
0
votes
5answers
248 views

Best way to keep a copy of data optimized for read

I have a system that handles various transactions from hundreds of clients a minute. Each transaction is limited to a subset of functionality, and thus for each type of transaction (circa 25 of those) ...
-4
votes
0answers
20 views

What could cause data to be received by XBee when writing data from coordinator XBee?

I'm working on a project with a sensor connected to an arduino which sends the data from an end device XBee S1 in API mode to a coordinator XBee and handles the data in Visual Studio using C#. The ...
17
votes
3answers
268 views

How to model a circular reference between immutable objects in C#?

In the following code example, we have an class for immutable objects that represents a room. North, South, East, and West represent exits into other rooms. public sealed class Room { public Room(...
3
votes
5answers
298 views

Polymorphism in nearly identical Classes

At the time I'm workin on a project with several Instances of an abstract class. Some functions in the subclasses are the same, some not. This would lead to code like the following. In the Code i use ...
5
votes
3answers
404 views

Can a function be pure if it depends on an immutable an instance field?

In the following c# code example, the instance field [name] is readonly, and therefore is immutable after class construction. public sealed class Example { public readonly string name; ...
3
votes
0answers
39 views

Get service data of future iterations

I have a doubt with threading data service calls within a foreach loop. Here it goes: Say you need to request data from a service and then process that data, for this example, let's say data request ...
0
votes
0answers
30 views

Is it wrong to pass the concrete Model through the View to the Presenter with MVP 'Passive View'

I have tried to implement the Passive View MVP in my WinForms application as much as possible. The Presenter is the only one who uses the Model and the Presenter responds to events that are generated ...
0
votes
2answers
113 views

Inter-Process Communication in .NET on the same computer

I want to split a C++/CLI application on two parts : 1. Communication Part, with I/O + logging on text file : 3 COM Ports, 2 sockets and 1 log file 2. UI Part, to handle the data received from COM ...
1
vote
2answers
181 views

C# Resolving database at runtime

I need to be able to support clients on both MySQL and PostGres databases in a legacy application that does not use any ORM. Say, I have the following interface to query a list of users. public ...
2
votes
2answers
81 views

Using a superset DTO for a number of methods in a class

Consider a class with a number of methods that are required to return a number of values each. In a strongly typed language such as C#, we can have the effect of returning more that one value from a ...
1
vote
1answer
84 views

Why does C#'s System.Threading.Semaphore implement IDisposable and why doesn't java.util.concurrent.Semaphore implement Closeable?

In .NET framework, System.Threading.Semaphore is a IDisposable that require manually dispose. However, in JavaSE, java.util.concurrent.Semaphore is not a Closeable nor a AutoCloseable. Why do they ...
-1
votes
0answers
77 views

What is the benefit of using an “Expression body” over returning a field value?

Resharper is suggesting I change code in my properties to use the result of an expression body. Why is this and what is the benefit over just returning the private field value?
0
votes
3answers
113 views

Constructor method injection, is this a pattern?

Working on WPF (UI programming) in C# I've started frequently injecting methods into the constructor of my view models. For example: public class HtmlRegexListViewModel : ViewModel { private ...
2
votes
2answers
136 views

Best way to consume very dynamic/inconsistent xml/json

I don't know whether to call the data dynamic or inconsistent. But I need to create profile pages for people generated from xml or json. The challenge is in the data the is returned. The data is ...
0
votes
2answers
170 views

Let an object be configured by another class

I am currently planning a monitoring server for a distributed system. In a file (or maybe a database, someday) I save all the servers and parameters that I want to monitor. When the monitoring system ...
4
votes
2answers
318 views

Is it ok to have an empty abstract class to make concrete classes polymorphic

BEFORE: I have an interface that has one method definition public interface IDockable { void Dock(DockerContainerConfig config); } Everything is ok for my first implementation public class ...
4
votes
1answer
163 views

What's an efficient data structure to make a lot of queries between parents/childs?

I have the following scenario for which I've been experiencing performance problems: The context is a level editor of a new engine for an old video game (whose source is unavailable) in Unity. ...
1
vote
2answers
450 views

Why can't C# implicitly convert int to string?

C# allows implicit conversions of integers to strings when used in an expression. For example, this is completely valid: int myInt = 10; string concatenatedString = "myInt is " + myInt; string ...
0
votes
0answers
29 views

Should I create interfaces/abstract base classes when I only have a single implementation? [duplicate]

Lets consider a class "ClassA" that needs an instance of another class "ClassB", I can pass in this class in ClassA's constructor; public class ClassA { private readonly ClassB _classB; ...
0
votes
1answer
60 views

Handle object in handler or inside object

I've start wondering what's the best practice when handling objects in web development. Oversimplified the process when there is a page request often looks like: Page request. Fetch object data ...
4
votes
3answers
131 views

Using Nested Classes for Input and Output to a Calculation Method

We have a large project that performs a lot of modelling and calculations. This code is being broken down into smaller, more manageable chunks, by shifting particular calculations into their own ...
2
votes
2answers
138 views

Trigger C# code from the network using PHP

I'm working on a project where I have to trigger my windows desktop app to fetch the database for new rows once a user on the internal network send new requests. I have managed to hack this around ...
1
vote
1answer
61 views

I have a few questions about the MVP pattern in a WinForms project

I hope someone can answer these. I have a WinForms project with +/- 8 forms. I have an SQLite database and a class that handles the queries to this database. I would like to use the passive View ...
-2
votes
0answers
53 views

WebAPI in c# using a functional paradigm

I am building a WebAPI in c# and would like to use a more functional programming style. I understand that using a functional language would be better but thats not a option at the moment. Looking ...
0
votes
0answers
16 views

How should I structure an iPhone based offline Cache for OData?

I have an OData web service that I need to create an offline cache API for. This class will be leveraged by an offline-capable mobile client (iOS/Android/HTML5). One option would be a class that ...
0
votes
1answer
72 views

What is a good format to deliver a set of versioned files to a third party?

Background: We have less than a gigabyte of documents stored in a database. In most cases there are multiple versions of a document with the same name. The versions need to be preserved. I've been ...
-2
votes
1answer
52 views

Printing crystal reports from a web service to a network printer

We have handheld scanners in a big warehouse, and there are printers scattered around the warehouse. When certain events happen on the scanner I need to Print a Crystal report to a printer. The ...
1
vote
2answers
64 views

General approach to an interface that will resolve a dependency to a database library

Background I often write software for systems that are responsible for testing manufactured products. For every product that gets tested, we have to generate a report for the test-results. The way ...
3
votes
5answers
368 views

Import large csv files

I've been tasked to query 2 large csv files which are roughly 1 GB in size each. The files contain related data, so file one may contain a list of order numbers, Order Dates, etc and the file may ...
1
vote
1answer
226 views

Way for generating C# classes from existing C# class

I have simple POCO classes, like this: public class Book { public string BookId { get; set; } public string Name { get; set; } //etc... } I want to get all those classes and generate ...
3
votes
1answer
261 views

In c# how do people make complex functions

Hi I'm working on a c# MVC code first project. I've started the project and have created the Models, database frontend etc. Now my attention has come to writing something that can read an excel ...
1
vote
3answers
190 views

In-memory data collection object(s) vs database

I have a couple of questions about the practicality of developing a WPF application that loads data into memory from a text file and then manipulates the resulting object(s) instead of transactions ...
0
votes
1answer
44 views

Differentiate Callers in WCF Service

I am working on a WCF Service that returns the Status for a Device. A Device has multiple Status for different Companies. I need to develop a WCF Service that allows a Company to retrieve the Status ...
3
votes
3answers
133 views

Is there any point in using builders and fluid interfaces with object initialisers?

In Java and C#, you can create an object with properties that can be set at initialisation by either defining a constructor with parameters, defining each property after constructing the object, or ...
3
votes
3answers
119 views

Should I implement a obfuscated spec literally?

I'm tasked with implementing a spec for a simple simulated shopping system. The spec however uses strange abreviations everywhere (it has a 2 page long table of nonsense abreviations). For example the ...
3
votes
1answer
106 views

Misunderstanding of viewmodels relations on client and server side

I have basic viewmodel on server-side, let it be on C# language and ASP.NET Core server-side, for example: public class BookViewModel { public string Id { get; set; } public string Name { ...
3
votes
0answers
98 views

Entity Framework and avoiding the Anemic Domain Model

In our business logic we occasionally have methods defined something like this: User.ResetCourse(Course courseToReset) The problem is that both User and Course are Entity Framework proxy objects. ...
1
vote
1answer
64 views

Two data sources merged

I have a save game editor. It uses a library that can read the file and return it in a form of an object. Within that object is an ItemSave object. Also, to be able to interpret the data in the ...
0
votes
1answer
178 views

How to go about upgrading spaghetti code? Is it worth it? [duplicate]

I'm working on medium sized ASP.NET MVC 4 web app, that is about 2.5 years old. Around 25-30k lines of code. The project has never followed any of the good .NET design practices. It is a very tightly ...
3
votes
1answer
137 views

Is it good practice to check in updated assemblyinfo.cs files after build

Our build process changes the version number of all AssemlyInfo.cs files, so that the version number can be managed completely by the build server. Right now, we commit the changed AssemblyInfo.cs ...
-2
votes
1answer
249 views

Fastest way to retrieve data in an area based on xy coordinates?

So I have an unsorted data set with x and y float coordinates as keys. The data is in a txt file. It looks like this: x,y,data; x2,y2,data2; etc I need to retrieve all data in a specific ...
0
votes
1answer
90 views

Designing an Order service that accepts many types of orders

I've been having some trouble coming up with a design that would alleviate most, if not all, the issues I've been running into, and I'm wondering if it is my base design. Our company accepts orders. ...
0
votes
1answer
85 views

remote interaction with WPF C# desktop application

I have created a standalone application with WPF and I need to use some of its functions via web. In few words, I would like that an user can access a web page and have the chance to insert some ...
2
votes
1answer
57 views

Best way to store ListView Data(ListView.Items) into file

I just came across this question telling how to store ListView Data(basically ListView.Items) into a text file but it got me thinking that, is it the best way to do it? In terms of efficiency, ...
1
vote
5answers
217 views

Class with large number of properties

I have a class which will have a huge number of properties (30 to 50). A huge numnber of these properties will be read only on the client. Is it a good practice to have one class with lots of ...
3
votes
2answers
81 views

Remove gaps between non-overlapping segments of an array of time elements

I have an array of elements, each with a start time and an end time. These form a timeline, some of which overlap, and others that do not (and have a gap between groups of overlapping elements). I ...
-1
votes
2answers
138 views

Which design pattern for an alerter

I'm really struggling to come up with a design pattern for an Alerter I'm building. Here's a contrived example of what I'm trying to do: A person wants to get an alert by weather type (rain, snow, ...