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
0answers
39 views

Using xsd2Code and custom c# classes

I am using the xsd2code class generator to generate classes based on a schema file provided by a system vendor. This vendor also provides a REST API to access data via Web Services, and I've had a ...
6
votes
4answers
175 views

Should we define types for everything in C#?

Recently I got into a problem with the readability of my code. I had a function that did an operation and returned a string representing the ID of this operation for future reference (A bit like ...
0
votes
0answers
16 views

Custom serializer or create base class which implements IXmlSerializable?

I am working on a project where I have very specific xml serialization specifications, that is: Some properties are elements, some are attributes Some properties are required others aren't Some ...
0
votes
0answers
32 views

Is there a better way to retrieve a ViewModel container starting from a Model?

I'm trying to figure out a more efficient method. To start, I have a viewmodel wrapping around a model. The model itself collectively becomes a tree. We'll call each model a Fragment: public class ...
0
votes
2answers
132 views

Server and Client apps that will send files and other info to each other

I am trying to do a Server and Client programs, that will communicate with each other, but I can't figure out the best way to do it, so let me explain what I need: The Server app should be able to ...
5
votes
4answers
601 views

How to add a property to an object you can't change?

Let's say that I'm using a library and I would like to add a property that doesn't exist to an existing class. In this case, I'd like to add Color as a property of Fruit. namespace Library { ...
0
votes
2answers
67 views

Data integrity, BinaryWriter, C#

I've developed a data acquisition system for a scientific experiment. An FPGA buffers the scientific data in a FIFO and a C# program empty this FIFO at a rate of ~45MB/s. Because the duration of the ...
3
votes
3answers
348 views

Use interface or abstract class?

Now the title might seem like the question has been asked before but let me explain my situation and you'll see why I am asking this question. Let's consider this interface : public interface ...
0
votes
0answers
48 views

Offer limited feature in app [on hold]

I want to add a feature to my app that user can avail only twice or thrice in the trial mode. I am unable to figure out which purchase mode should I implement. I successfully implemented the ...
2
votes
1answer
541 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 ...
0
votes
1answer
64 views

Sharing core repository and object mapping logic between Unit of Work methods

I'm wondering if there is a better way to do this or if I'm doing some anti-pattern here. Like I say in the subject, I'm trying to share repository calls and object mapping logic between Unit of Work ...
7
votes
3answers
438 views

Enterprise software: Where should the code go? [duplicate]

I recently went for an interview with a software company that claims to write enterprise level software. During the interview, the interviewer remarked that its better to use the database simply to ...
0
votes
3answers
443 views

Should I keep all my class definitions in the same class library?

I am starting to work with class libraries in my C# class. We were told to write code that can be used more than one time. Should I keep all my class definitions in one class library for the length of ...
3
votes
1answer
289 views

Pattern to use to relate multiple data sources to different user data widgets

I have an client x server intranet application the basically gets data from the server, format it and send that data to the client for display. At the server we are using ASP.NET C# running on IIS ...
2
votes
2answers
187 views

Where to put a common database connection for my classes

I have several classes (Repositories) which do the task of saving/retrieving some objects in/from database; all of them need to establish a connection to one database. I thought in order to avoid ...
3
votes
2answers
131 views

Factory for creating a singleton instance

We have some legacy code that has a bunch of singletons all over the place (written in C#). The singleton is a fairly "classic" implementation of the pattern: public class SomeSingleton { ...
0
votes
0answers
45 views

Enterprise Mashups. A good approach for .net

I'm in the middle of trying to talk our management into letting us do a portal that sits across the many, many systems that we use. I believe in using the best tool for the job so we have a good ERP, ...
-1
votes
0answers
33 views

Wpf reports for modern windows theme

I am a college student creating a WPF program for the 3rd year project. At this moment I have completed the most parts of the project. I want to know what are the available report types for WPF. The ...
1
vote
1answer
117 views

How much trouble can the use of Singleton class as Model cause?

In my latest WPF applications I've been using a Singleton class, that I call Model, to contain all my application's logic, such as file reading, information handling, etc.. In the WPF Views or ...
-1
votes
0answers
38 views

What are the differences and/or purpose of these assemblies? [migrated]

What is the difference and purpose of assemblies located in C:\Windows\assembly in C:\Windows\Microsoft.NET\assembly Which one are used by intelisense?
0
votes
0answers
27 views

How should I develop Web App DB with Azure continuous [on hold]

I want to develop new Web App with Microsoft Azure. I have a repository on Bitbucket. The Continuous Delivery with Azure is set up, so when I push my changes Azure builds the app and deploys it to ...
-4
votes
0answers
44 views

How to evaluate your programming ability [on hold]

I'm diving deep into C# and I want to evaluate my progress. How could I guague my ability in C# compared to others? Is there a service that gives me a numerical score? I've looked and I couldn't ...
159
votes
9answers
11k views

Why do many exception messages not contain useful details?

It seems there is a certain amount of agreement that exception messages should contain useful details. Why is it that many common exceptions from system components do not contain useful details? A ...
0
votes
3answers
297 views

Bad Practice using Auto Generated Classes for Data Access

I've seen this before but haven't found concrete reasons. When you add Entities to your EF model, EF auto generates classes for these entities. In terms of DataAccess, why is it preferred to not ...
1
vote
2answers
223 views

Generics in C# Test Class

I'm learning about unit testing in C#. Languages_Service and PlaceOfWork_Service are classes for SOAP services which Microsoft Navision generated for me. There are several methods that are very ...
2
votes
1answer
129 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 ...
1
vote
2answers
251 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 ...
11
votes
5answers
1k views

How to migrate my thinking from C++ to C#

I am an experienced C++ developer, I know the language in great details and have used some of its specific features intensively. Also, I know principles of OOD and design patterns. I am now learning ...
-2
votes
0answers
81 views

How much developer efficiency would be lost switching from C# to C++ [closed]

If you switched from C# to C++ how much less developer efficiency would there be? There could be benefits in using c++ for cross platform portability as demonstrated by Herb Sutter ...
2
votes
2answers
288 views

Putting it all together [closed]

I've been reading a few books on c# development over the last few months (clr via c#, architecting applications for the enterprise, c# 4 in nutshell just to give you an idea). I really feel it's been ...
2
votes
2answers
127 views

Technique to synchronize error codes in a same-project-API

In the project I am working right now, we have some python and some C# code. At some point, I call from python a subprocess which starts a C# executable. This C# code returns an error code, which has ...
0
votes
0answers
38 views

Creating Dynamic Odata Feeds at runtime, c# [closed]

EDIT I need a dynamic odata service to which I can pass a sql query and have it return the related fields, without the use of entity framework. Obviously security is a must so I would implement some ...
3
votes
3answers
995 views

Would this be a proper use of threading?

After reading various MSDN articles, tutorials, and posts on here I came up with a design for a windows service that I wanted to make sure my threading strategy is proper and won't lead to memory, ...
12
votes
5answers
2k views

Can I use Dependency Injection without breaking Encapsulation?

Here is my Solution and projects: BookStore (solution) BookStore.Coupler (project) Bootstrapper.cs BookStore.Domain (project) CreateBookCommandValidator.cs CompositeValidator.cs IValidate.cs ...
1
vote
1answer
48 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 ...
2
votes
2answers
155 views

How/when to “build” a Singleton that stores configuration data

I am a junior developer (think "intern-level" experience) working at a small shop more or less alone on a project that consumes data from a database, processes it, and inserts the results into another ...
1
vote
1answer
92 views

Excel worksheet population and fomatting is slow

I have written a VSTO plugin in C# which populates several worksheets. During the population process cell values or formula are added one at a time according to user-definable criteria taken from a ...
-3
votes
0answers
22 views

C# Thread Abort hanging in .NET 4.0 but not in .NET 3.5 [closed]

In VS2013, C#, in Win8, this simple line of code thrListener.Abort(); was just fine in .NET 3.5 but now just hangs indefinitely in .NET 4.0. (I'm a beginner when it comes to multithreading.) I can ...
2
votes
2answers
63 views

Sharing info objects between objects?

I'm making a game and I have several cards that are created during the game. Each card needs some info, which is shared between cards of the same type. So I have a class CardInfo, which holds a name ...
45
votes
8answers
5k views

Why a static main method in Java and C#, rather than a constructor?

I’m Looking for a definitive answer from a primary or secondary source for why (notably) Java and C# decided to have a static method as their entry point, rather than representing an application ...
-3
votes
0answers
16 views

TreeView Selection [closed]

I am using a Server Side TreeView Control. I want to get the values after the selection of the items present in the treeview. Actually I can't able to differentiate between the selected items that ...
0
votes
1answer
84 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 ...
0
votes
1answer
54 views

How can I avoid an SDK requirement for an end-user unless he uses a specific function? C#

One of the modes of my program uses Microsoft Kinect but the user may never decide use that mode. I want to make it so the libraries for that functionality are only looked for and loaded if he uses ...
1
vote
1answer
46 views

Down Sides to Using Properties as Opposed to Method Variables [closed]

I am debating the pros and cons of a couple of utility classes I have. The classes have a couple of properties which are set prior to calling the class methods. However, I was wondering if there are ...
-3
votes
1answer
36 views

Is it possible to use C and C sharp together? [closed]

I have tried reshearching this question but couldnt find ant luck. Is it possible to start a project using C Sharp and C together?
0
votes
0answers
57 views

what are the most important coding standards in c# [closed]

I am a college student creating a C# program for the 3rd year project. In my project coding standard is a main concern. But I do not have a better understanding about C# coding standards to follow ...
-1
votes
1answer
106 views

How to selecting Teams with Minimum Difference between Knowledge Levels

For the below challenge from a programming site, I am bit confused. Problem Statement: A Professor of Physics gave projects to the students of his class. The students have to form a team of two for ...
10
votes
3answers
1k views

How to monitor a long-running program programmatically

What I've currently got can be summed up with this pseudo code: public static void Main(string[] args) { var listOfObjects = Database.GetObjectsToUploadToOnlineService(); ...
0
votes
0answers
69 views

C# async method on Windows Phone 8.1 (Nokia Lumia 920) [migrated]

I am trying to better understand Windows Phone 8.1 app development and thought it might be smart to start with a sensor application. So, using examples from around the web, I was able to figure out ...
2
votes
1answer
111 views

Alternatives to #if when polymorphism doesn't seem possible

There are couple of places where #if seems to give you abilities that polymorphism doesn't: Conditionally specifying base class When a section contains code that is not recognised by a compiler on ...