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

-6
votes
0answers
32 views

Looking for Clarification of Visual Studio versions [on hold]

Does Visual Studio 2013 Pro version provide database access to non SQL Server and SQL Server databases? Would like a short explanation what the MSDN subscription is as well? Thanks in advance.
0
votes
0answers
16 views

Dealing with stale data / currency issues when lazy loading related entities

Imagine I have two associated domain entities with a one-to-many relationship. Here is an example with Customer and Order classes: public class Customer { public int ID { get; internal set; } ...
-3
votes
0answers
76 views

Coding application which need huge data!

I have to code windows desktop application in c# wpf mvvm pattern. I have a 4 to 5 tables in database. And each tables have few thousand rows. I have to create an application and the data for that ...
3
votes
3answers
418 views

Is it a bad practice to use Nullable for non value types?

I know the nullable construct in C# was introduced to support null for value types. However, the language does not seem to have a problem with using nullable on other types. I wonder if this is a bad ...
0
votes
1answer
26 views

Provide part of context to class using interface

Currently I have class Context which I inject in some places in my code, like: protected override object GenerateSomething (object input, Context ctx) Depending on Context, Generate method gives ...
0
votes
3answers
117 views

Best algorithm to determine whether two arrays can be the same in a circular queue

I'm trying to figure out an efficient way to determine whether two distinct arrays of the same size can be shifted to form the same circular queue. For example: Array1 = ['A','B','C','D'] Array2 = ...
0
votes
0answers
14 views

ASP MVC Performance Analysis in Azure

I have a web application based on asp net boilerplate using EF6. The site is in it's finishing phase and I'm trying to tweak the performance to the best of my abilities. I was able to reduce the ...
1
vote
2answers
77 views

Non-printable characters and editors

Today I was presented with a very nasty problem and I do not quite know where to ask this but hope here is ok. So I have the following string: "\0" (at least that's how it looks in visual studio). If ...
2
votes
2answers
71 views

How to handle an aggregated list of the fields of multiple objects?

I have some objects each hold a list of variables, and a list which holds all variables of these objects, for example class A { List<Var> varList; } class B { List<A> aList; ...
0
votes
0answers
22 views

How to serialize a 2d array to a text file in C# [migrated]

I am working with 2D arrays (around 500 of them). I need to print them in a text file in a particular format. For now I just loop through each element of each 2D array and writing in the text file. ...
-2
votes
0answers
28 views

How to generate security header in WSI profile from WCF service client [on hold]

Changed the code with WSE extensions.Basically i am trying to call external web service from WCF service, but in the provided wsdl and xsd i saw that there is user token element, when i searched in ...
1
vote
0answers
94 views

Events in WCF Service Architecture (Server Side)

Problem: Now, I have some events that will take place when the client submits a request to the server. These events will arise on the server and they will be subscribed by the services themselves ...
7
votes
1answer
156 views

Why it is not possible to overload compound assignment operator in C#?

The title is be misleading, so please read entire question :-). By "compound assignment operator" I have in mind a construct like this op=, for example +=. Pure assignment operator (=) does not ...
1
vote
1answer
73 views

Emulate 12bit uint in c#

I recently had to do a codility test. The question itself was reasonably easy. take a string of numbers and +, * loop through it, if the character is a number, add it to a stack, if its an operation ...
-2
votes
0answers
21 views

Google CustomSearch API Image Search Not Working [migrated]

using System; using System.Net.Http; using System.Threading.Tasks; using System.Web; using System.Configuration; namespace Foo { class MainClass { public static void Main (string[] ...
2
votes
1answer
59 views

How to handle overlapping classes

I'm putting together a program to try and recreate a board game. My goal was to keep the rules and actually actions of the game separate from its presentation, so I am creating a library that contains ...
0
votes
0answers
45 views

How to verify a method is only called once, with specific arguments (using RhinoMocks)

I'm just starting to use RhinoMocks. Now I'm wondering what test cases I should write. I want to assert that a method is only being called once, with specific arguments. Lets start with my ...
5
votes
1answer
96 views

Good way to program an orchestration / processflow

I'm programming a process in which clients will be separated in 3 different groups, and for every group a different action will be performed. My question concerns the process of deciding which client ...
0
votes
0answers
67 views

How do I model this Shipping Routes scenario?

Trying to begin coding this solution. I have a scenario as follows below: A shipping operator has a network of routes to various ports, the routes are specified explicitly below Buenos ...
-2
votes
0answers
52 views

Does the user need to install CS script himself if i use it in my C# program? [closed]

The current program i am making has come to the point where i need to include some kind of scripting. Looking at the avaliable stuff CS script seemed the best solution for my problem. Now the problem ...
3
votes
1answer
133 views

Where to store configurable, global settings

As an example, let us say that I have an application with multiple users and multiple administrators. I want the administrators to be able to configure sitewide session timeouts. The code would ...
1
vote
2answers
117 views

DLL or web service for common functions?

We have a variety of basic functions (date utilities, email sending, internal math calculations, etc) that are currently in an old VB.NET project. We're going to move towards C# and I'm wondering if ...
4
votes
2answers
187 views

C# obtain derived class from base

I am trying to build a dashboard that allows a variety of widgets to be displayed on the home screen. They are structured as follows: public abstract class Widget {} public abstract class ...
2
votes
1answer
116 views

Call method in a disposable object at the beginning of a “using” statement

When we use the lock statement, it is essentially doing a Monitor.Enter at the beginning of the locking block and a Monitor.Exit at the end of the block. This process is automatically handled by the ...
0
votes
0answers
37 views

Class design for an app that reads data from Active Directory

I am hoping someone can help me regarding design and architecture for an application. The application is basically a service written in C#. The purpose of this service is mainly to read data from ...
1
vote
3answers
172 views

Using prefix/postfix increment operator for simple incremental array access rather than actual index numbers

I cannot decide which method is better with consideration of both readability and fault-tolerance. Method #1: Object[] objects = getArrayOfKnownLength(); int i = -1; someMethod(objects[++i], ...
2
votes
2answers
187 views

How to iterate between these elements

I have an array of elements: int[] elem = new int[] {A, B, C}; I need to calculate the sum of ALL the combinations of those elements, where only some of the elements can be optionally selected. I ...
5
votes
3answers
225 views

When should I use C#'s implicit type conversion operator?

In C#, we can overload the implicit conversion operator like this (example from MSDN): struct Digit { /* ... */ public static implicit operator byte(Digit d) // implicit digit to byte ...
0
votes
0answers
42 views

Pushing data into chunks from server to mobile client

I am developing a windows phone application. On the first screen user enters some unique code and based on that code there are say 200 or more records on the server which I want to return to the ...
1
vote
2answers
300 views

.NET Why should I use DAL over direct database access

Yesterday on one of SO chats I've been told I should never connect to database directly from the application and rather use DAL. I've been told that: 1. Using something in the middle should improve ...
8
votes
2answers
336 views

Big O equivalence for LINQ select

I'm trying to determine if there is a change in the Big O equivalence of a nested loop when I use a LINQ select instead. public void myFunc(List<Foo> fooList, List<Bar> barList) { ...
0
votes
1answer
67 views

Why is it faster to compact a portion of the managed heap than the entire heap?

I was reading this article on MSDN. In the first paragraph under the "Generations and Performance" subheading is written: First, it is faster to compact the memory for a portion of the managed ...
2
votes
1answer
115 views

How do you handle saving blog tags in MVC?

I'm writing my own blog engine as a learning exercise. The blog is fairly functional right now but I'm trying to add a 'tag' feature to it and I'm confused as to what the best way to handle saving a ...
0
votes
3answers
236 views

What arguments are there to use a coding style for each distinct language? [duplicate]

I recently had a discussion about our coding style for C# projects. Two things in particular were very hard to agree upon. Method Naming C# has the de-facto standard of naming (at least public, ...
2
votes
2answers
68 views

Share some fields but others unique to owner of instance

I've been programming for many years and this is sort of a strange need and I've never seen anything like this but I have a game where there are abilities that you can do. There is an ability class ...
2
votes
2answers
256 views

Refactoring long methods with a lot of cyclomatic complexity

I'm attempting to refactor what is becoming a very large method -- currently 350 or so lines -- that contains a high degree of cyclomatic complexity. I understand and ascribe to the theories that ...
6
votes
3answers
266 views

How to explain design decisions when refactoring code

I am working on a colleague to refactor the following code, I am trying to turn this into a teaching experience as well. Original Code public class WidgetRepository { public Widget ...
0
votes
1answer
63 views

c# class generation/architecture for json rest service

I want to consume part of the Steam WebAPI, it's a simple Rest Service but it produces some complex json. I thought about using the Newtonsoft Json.Net Library generate my c# objects. Whats the best ...
-2
votes
0answers
62 views

OOP vs ADM Comparisom

This is the ADM equivilant to the example code given in Correct placement of Methods in OOP In this example we have resolved the Method placement question by moving ALL methods away from the data, ...
1
vote
4answers
262 views

Why I need to make method of my class private, If I need to access it throughout my application?

I am going through the beginners tutorial for C# from a website http://www.homeandlearn.co.uk/csharp/csharp_s10p1.html On chapter of classes, it makes the method of class private and then use ...
1
vote
3answers
192 views

c# application to read xml files, parsing them, storing locally in data structure and writing to csv

I have to develop a c# application that will read large xml files. XML files will have data about computer systems (i.e. Hardware, software, network, bios information). There will be separate xml file ...
2
votes
4answers
177 views

Failover for High Frequency Jobs

I have a job that runs at a fairly high frequency (~1x every second). This job needs to be executed constantly as long as the web app is running. However, I really only want 1 instance of the job ...
3
votes
1answer
262 views

Correct placement of Methods in OOP

Which Class should contain a method which has dependencies on multiple classes? I've coded up a specific example to avoid generalizations. In this example we have an initial requirement : ...
3
votes
4answers
259 views

Design method to return List of objects

I need to create a method which will return a List of IRule objects. This is what I have written, am I correct in the approach? Or should I follow any patterns/principles? public IList<IRule> ...
0
votes
0answers
71 views

Multi-threaded winforms with multiple child forms using sockets

I develop application with two main option grouped by groupBox in main form. First option is run server with specific behaviour for example I choose TCP protocol, type IP address, port number and ...
3
votes
3answers
324 views

Functional vs object-oriented style in C#

I'm learning functional programming and face the following confusion when applying it to my C# projects: I begin by writing pure, static functions and use function composition. After the code ...
0
votes
0answers
30 views

C# - Array.Find() not assigning a struct return value [migrated]

I am attempting to use Array.Find() to return a structure, from an array of structures, and assign it to a structure named Result. However, Result's values never change from null (I ran it though the ...
1
vote
1answer
128 views

Should I use: One event multiple subscribers or multiple events multiple subscribers

I am writing a data acquisition application. I wondering whether I should use one event multiple subscribers or multiple events multiple subscribers. I am worried about performance. Also could I ...
-5
votes
1answer
186 views

Why is one language with elegant easy to read syntax as fast as one with the verbosity or explicitness? [closed]

There are 2 distinct types of programming language design categories in my eyes. We have C++/Java/Rust/C# languages on this side, Fast for the most part but also a bit verbose or explicit. On this ...
0
votes
0answers
69 views

Is using Interface implemented by single class a not recommended practice? [duplicate]

I have several classes in C#, not just POCO class but with methods and implementations. Each of those classes implement one Interface. e.g. IPerson implemented by Person class. Employee implements ...