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

Creating Dynamic Odata Feeds at runtime, c# [on hold]

We have a program that exposes authorized sql tables to the user and allows them to select from the available tables and some fields. The program then returns a file with a bunch of sql statements. ...
1
vote
0answers
43 views

Partially Fulfilled Specification Pattern

We have a model (IPayableModel) with a boolean property indicating that a user may or may not pay for the item. A set of specifications defining criteria that would disqualify the model from payment ...
-1
votes
1answer
50 views

How to upload a C# project to Github without visual studio [on hold]

I would like to know How to upload a C# project to Github without visual studio? What do i need and how would I do it?
-2
votes
0answers
60 views

Looking for resources for 70-483 - Programming in C# [on hold]

I am looking for material for the exam 70-483 - Programming in C#. Some way to asses my level compared to the exam in different areas. Material with a lot of Intermixed exercises (In the books I ...
-4
votes
0answers
21 views

Generate Charts in Excel by passing data from MVC 4 C# controller using report viewer [on hold]

Am current doing reporting in Excel and PDF formats using Report viewer ,I wanted to generate some interactive charts in my reports. But as far I researched report viewer doesn't allow interactive ...
0
votes
0answers
31 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 ...
-3
votes
2answers
114 views

Confusion about Constructors and properties [on hold]

So im doing a project with a guy and I see in His code something like this: public class Foo() { private string example; public String Example { { get; set; } } public ...
-2
votes
0answers
145 views

Why do C based languages use a colon for the case's? [closed]

Why is a colon used at all? For example: switch( c ) { case 'A': CapitalA++; case 'a': SmallA++; default : total++; } Instead of: switch (c) case 'A' ...
1
vote
2answers
86 views

To convert to accurate data types or maintain default type of string

Scenario: I have a web application that records and checks data against two temp tables (1 table being a temp source and the other being a destination for the application). These temp tables are ...
1
vote
2answers
134 views

How do I do SQL Server mapping with a new Desktop application written in C#? [on hold]

In 2 weeks I will be starting a new job as a software developer in a company that currently does not employ any professional programmers. My first task will be to rewrite a Excel/VBA application in ...
2
votes
1answer
46 views

Two way communication between Form and plugins

I have started to develop a support tool for an old legacy system that is no longer maintained but still needed for the foreseeable future. The legacy system offers few, clunky and error prone methods ...
0
votes
2answers
75 views

Handling Business Logic/Validation Race Conditions

I'm working on a Training Enrollment web application with the following (simplified) features: Maintenance (Add, Edit, Deactivation) of Trainings Student sign-up Student enrollment to Active ...
156
votes
9answers
10k 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 ...
1
vote
1answer
90 views

Under what cirumstances would type 'System.Object' qualify for serialization?

I'm in charge of a comprehensive serialization format with support to serialize runtime objects (any derived type of Object). I can't find a sane scenario where one would choose to serialize an ...
-1
votes
1answer
111 views

override resolution behavior in c#

I tried the following piece of code public abstract class Entry3 { public abstract void Method1(); public virtual void Method2() { Console.WriteLine("Entry3.Method2"); } } public abstract ...
-3
votes
0answers
28 views

How to use the Trx library to build a financial switch processor [closed]

I want to build a switch engine processor using the Trx framework and I can't find any docs on it. Please kindly provide a code sample
2
votes
1answer
86 views

Ambiguity of seemingly clear method names in APIs

(The question is language-agnostic, but to illustrate the point, I wrote the examples in C#.) Say I'm trying to model the behavior of "components" that communicate via "ports". I might model this ...
1
vote
1answer
82 views

Clarification on MVC Architecture Overview

I'm doing an MVC 4 architecture diagram for a report and since I'm relatively new to MVC,i was wondering could some one clarify with me is REST (HTTPPOST etc) between view and controller, or ...
-2
votes
1answer
49 views

pass a variable as parameter to constructor c# [closed]

pass a variable as parameter to constructor as i want to change the variable value with changeable value i'm new to c# so that i tries to implement one thing in many way i did what i want to do with ...
1
vote
1answer
32 views

Databinding When View Differs From Model

I have an entity Customer. Customer has a collection of Accounts. I have corresponding classes. The Customer class has-a List<Accounts>. I have two views. First page shows the Customer's name, ...
-4
votes
1answer
181 views

Why in C# int template/generic parameters were not added? [closed]

A note for CO fans: I am not looking for current opinions, I am looking for historic event, and since it is history, it is a fact now (something that occurred and cannot be changed). C++ templates ...
0
votes
0answers
53 views

Matching groups of similar lines on a generic matching algorithm

I have to write a program to search through a file containing lines and find lines that match to a degree of tolerance but are not necessarily the same. So for example the following lines would match: ...
3
votes
2answers
136 views

How do you find out what resources are unmanaged?

Looking through the .NET documentation, specifically the WebRequest class, I don't see any information indicating that I should wrap an instantiation of it in a using statement. Even the provided ...
0
votes
0answers
42 views

DDD using an ORM and a Active Directory Server for Persistence

With Domain Driven Design one would model out the domain. One would then use an ORM of some sort to take care of the persistence. Say you have a Product entity which has a Name, SKU and an Owner. This ...
10
votes
4answers
2k views

Should one use Dependency Injection even if the class is used only once? [duplicate]

During a code review I have started having a bit of a dilemma as to whether use dependency injection or not. I would like to hear your thoughts, because this is kind of an ongoing theme and would help ...
2
votes
2answers
134 views

Unit testing and reusing extracted class

Currently I have 3 service classes, they all have a similar pattern, and I need to make a 4th service class which amalgamates the functionality of the other three. Current three classes public class ...
0
votes
1answer
113 views

What's the point/Use of writing out just the method signatures for an API in .Net Web Api

I have been asked to write the signatures for and API end points GET/POST/PUT methods. I'm having a hard time wrapping my head around what the point of this is. My co-worker asked if I could do this ...
0
votes
1answer
143 views

C# Constructor and private LINQ to SQL members

I am extending an application I have developed so that it is more broadly useful for multiple jobs, rather than the single job I created it for. There are a number of tables that I get from SQL ...
24
votes
3answers
3k views

How much work should I place inside a lock statement?

I am a junior developer working on writing an update for software that receives data from a third-party solution, stores it in a database, and then conditions the data for use by another third-party ...
-2
votes
0answers
7 views

AForge Blobcounter problem -how to count splitted objects? [migrated]

I have a problem with counting small objects on the image. In example I used BlobCounter class (from AForge framework). But it doesnt recognize splitted objects. Here is the function output Here is ...
2
votes
2answers
175 views

Designing entities that should be mutable through the GUI but protected from programmer error

I have a set of entities, for now represented by very simple classes (further simplified for this example): public class Item { public string Name { get; private set; } public double ...
1
vote
1answer
94 views

C#/MonoGame - Programming enemies and levels in external script files

I'm writing a little game using C# MonoGame and I have idea of scripting enemies in external script files (not necessarily in C#, maybe in lua?). So for example I have class Enemy in C#. And I want ...
1
vote
0answers
53 views

Weighted (Perlin?) Noise generation

Is there a way I can "Weight" a noise generation algorithm to a specific point i.e the center of the generated "image" or one of its corners, assuming the generated "image" is square? I have been ...
1
vote
2answers
69 views

Reading Element Names vs Reading Element Attributes: Speed C#

I am working on a project where there are a whole bunch of strings being stored in an XML file for later retrieval. Stored with each string is between 0-10 tags that a user can use to access and sort ...
0
votes
0answers
14 views

C# How to define TcpListener for IP address [migrated]

I have looked through some examples of TcpListeners and TcpClients , and in one example the server side TcpListener is declared like this TcpListener listener = TcpListener.Create(8080); ...
0
votes
1answer
45 views

Where is a DataTable appropriate and where is a List with a class? [closed]

Given Employee data, say: Name,Age,Gender Under which situations would it be appropriate to use a DataTable with the appropriate columns, and when would it be right to create an Employee class and ...
1
vote
0answers
33 views

Receive data using TcpListener and TcpClient and distinguish between file and raw data [migrated]

I am having a really hard time figuring out how to make my program work, here is what it is: Server and Client apps Client app will send data to the Server directly, using TcpClient Client app will ...
1
vote
2answers
139 views

Using static classes to define methods for handling POCO class objects

I am pretty new to the OOP paradigm and for this current project of mine, I need to design and develop a web application backend in .NET MVC using C#. A friend of mine told me that the class objects ...
7
votes
5answers
851 views

Why are objects instantiated this way?

Some times I see an object instantiated this way. ICustomer oCustomer = new Customer Obvious but the Customer class is implementing ICustomer interface in this example. Are there any advantages of ...
4
votes
3answers
980 views

Best way to define, start and stop threads in C#

I am making a little program, which have few Threads, constantly running. At some point, I may want to stop one of them, and then, after random period of time, to start it again. So first, what is the ...
3
votes
4answers
361 views

Why does CI stipulate that we should be able to rollback to any version of a software?

I was reading the book "Continuous delivery, reliable software deployments through build, tests and deployment automation ". And the author mentions that one should be able to rollback to any version ...
0
votes
2answers
104 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 ...
1
vote
3answers
179 views

Pass the whole object to a method or just parts?

I have an object that has about 50 properties, but one of my methods only uses about 3 of these properties. Is it still better to pass the whole object or parts. A scenario would be were I am using ...
-1
votes
1answer
57 views

How to test model binding within an MVC controller when Bind attribute with Include list is used?

Auto-generated action methods in MVC5 make use of the BindAttribute with an Include list that contains the field names in a string literal. Example: // POST: MyTable/Edit/5 // To protect from ...
0
votes
2answers
115 views

Simple TimeZones

I need to send out emails based on a timestamp. But the timestamp must be what the user expects it to be. The timestamp is set by the user submitting an object. E.g Al from L.A in the U.S saves an ...
1
vote
1answer
211 views

Doubts about architectural pattern for customizable standard enterprise application [duplicate]

My company needs to build an application to be rolled out for a lot of clients. This software will have many modules and functionalities, but some of these will need specific adjustments for some ...
2
votes
1answer
99 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
3answers
169 views

C# Subject Observer Architecture question

I'm making a C# application using the Subject Observer design pattern in a slightly different way. I am passing the Provider Class, implementing IObservable (this has the OnNext() method that ...
0
votes
1answer
100 views

Should I initialize a member variable in declaration when it is initialized by a constructor parameter?

Which is recommended for initialization of class fields in C#: class Foo { public X x = new X(); // or any default value... public Foo(X _x) { x = _x; } } Or class Foo { ...