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

-1
votes
0answers
21 views

C# Semicolon ; End of Line Shortcut

I'm working in VS.NET 2013 and when I type "(", the ")" is autogenerated so that my cursor (depicted as "|") is located like so: fooBar(param1|) It would be oh so lovely if hitting shift+enter ...
0
votes
0answers
4 views

crystal report to pdf without report viewer [migrated]

i would like to know how to export crystal report to pdf format file without pointing to crystal report viewer in code. below is my working code with report viewer but i would want to do so without it ...
0
votes
1answer
173 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 ...
7
votes
2answers
671 views

Any reason behind hyphens in a GUID?

Just when I generated a GUID, I found some hyphens in between the character and also at specified intervals 8b55fec7-c987-4e7b-abad-16e5aaea9b53 Is there any story behind this? Note: My intention ...
0
votes
0answers
14 views

C# gets an enum, but doesn't work correctly with switch statement [migrated]

Im having some trouble with enums and then checking it with a switch statement. I'm not sure if I'm doing something super wrong, but I don't get any errors so hey. # Level.cs enum LevelID { ...
18
votes
1answer
568 views

Why structs and classes are separate concepts in C#?

While programming in C#, I stumbled upon a strange language design decision that I just can't understand. So, C# (and the CLR) has two aggregate data types: struct (value-type, stored on the stack, ...
2
votes
1answer
151 views

Reducing the complexity of over-designed code

I have just started working at a company where I have inherited a C# codebase from a previous developer. I know programming well, have an engineering degree + an (unfinished, several year long) PhD ...
0
votes
0answers
32 views

Result with value or error returned from service c#

First of all, let me explain the current situation. In a ASP.NET project, we do some ajax calls to a WCF service. This service always returns a value when called. But this is the way they implemented ...
-1
votes
0answers
18 views

Using Events & Delegates in ASP.NET MVC [on hold]

I'm developing a multi tenant n-tier web application using asp.net Mvc 5. In my service layer I am defining custom events for every important action and raising these events once these actions are ...
0
votes
0answers
2 views

How to have only one of two DataGridViewCheckBox columns checked or true in a DataGridView [migrated]

I have a DataGridView with five columns defined. The user populates the DataGridView at runtime by selecting one or more files through an openFileDialog and the file name(s) are loaded into the first ...
0
votes
2answers
66 views

Create the fields in class level then instantiate inside methods or create and instantiated inside methods

I'm a newbie in software development. Just wondering which code is better and why should I continue which pattern should I follow. First Snippet: Class TestClass { private Object1 field = null; ...
3
votes
1answer
119 views

Tracing an object

Suppose I want an object with a list of strings and every method that this object gets passed to adds its name to the list of strings. Basically it's a stack trace, except unlike a stack trace it ...
1
vote
2answers
64 views

Concurrent collections, should read methods allow multiple threads at one time?

I have custom collection and I want to add wrapper to allow concurrent access. public class MyConcurrentCollection<T> { private MyCollection _collection; // passed in constructor ...
0
votes
3answers
144 views

Write a (good) code convention for c# [on hold]

As a relative new trainee in my company, I've been asked to write a code convention since the project is 6 years old and nothing have been done. Here's the points I came up with: VARIABLE ...
-4
votes
0answers
36 views

when i'm using 3 tier insertion try-catch, showingstack overflow exception..i'm new to the try-catch block pls help me! [on hold]

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data.SqlClient; using System.Data; namespace Wpf_threetier_test { ...
-4
votes
0answers
84 views

Do i have to learn mathematics deeply to be a software enigineer? [on hold]

I do not know nothing about about Software Engineering but I want to be a software Engineer and I am interested in Computer and also I am very bad a Mathematics. Help me out. :)
-1
votes
1answer
63 views

Mono and entity framework, which database to use? [on hold]

I was looking into monoproject website, and I saw they have entity framework support. Source: http://www.mono-project.com/docs/about-mono/compatibility/ But my question is: Is it supposed to be used ...
1
vote
2answers
777 views

Database Context and Singleton injection with IoC

All of the below relates to a ASP.NET c# app. I have a Singleton Settings MemoryCache that reads values from database on first access and caches these, then invalidates them using SQL Service Broker ...
0
votes
1answer
46 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 ...
2
votes
5answers
242 views

Is it bad or good to wrap mutable objects in immutable containers?

If I have parts of code that need to mutate the underlying data structure but then others that consume, not mutate the structure, is it good practice to create a wrapper which does not expose mutation ...
1
vote
0answers
95 views

Organizing namespaces and classes in directories [migrated]

When I put a class file inside a folder, Resharper suggest me to update the namespace. So if I have the file Classes/Game.cs (Class), it will suggest the namespace MyApplication.Classes. The problem ...
89
votes
11answers
23k views

What backs up the claim that C++ can be faster than a JVM or CLR with JIT? [closed]

A reoccurring theme on SE I've noticed in many questions is the ongoing argument that C++ is faster and/or more efficient than higher level languages like Java. The counter-argument is that modern JVM ...
1
vote
1answer
117 views

Does merely parameterizing a dependency meet the requirements for Inversion of Control?

When I find a concrete dependency inside an extension method, I have been attempting to remove the (concrete) dependency by parameterising it like so // original implementation public static ...
-3
votes
0answers
66 views

Migrate from .net to linux programming [on hold]

Ok, so when you start a desktop .net application with some database needs, you generally go this way: Open Visual Studio and create a windows forms/wpf application Decides which database you will ...
63
votes
7answers
78k views

Relationship between C#, .NET, ASP, ASP.NET etc

I'm really unclear on the difference between C#, C#.NET and the same for ASP and other '.NET' languages. From what I understand, .NET is a library/framework of... things. I think they're essentially ...
0
votes
1answer
35 views

Separate Drawable objects and their Data

I am looking for a way to design my application. Suppose you had a car drawing thing. Car has multiple parts.Some are going to be visible some are not.For example battery should be drawn. So someone ...
0
votes
3answers
411 views

Manage ClickOnce releases for different parties

I'm struggling with release management of a piece of software. First some general information: It is a ClickOnce application I follow the release often practice There are about 30 parties served ...
1
vote
2answers
608 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 ...
4
votes
4answers
973 views

Refactoring: When to add a new class in the project?

When do you feel that you need a new class (maybe when you are developing or after development for refactoring purpose)? Maybe I can start from my existing variables and think how I can reorganize ...
0
votes
1answer
35 views

Project type for a matching application to run on schedule [on hold]

I am about to start work on a new project, and I am looking for some advice on what approach I should take in terms of what kind of project it should be. Basic overview of requirements The system is ...
1
vote
0answers
39 views

How shall I project CQRS command and query services through WCF

I got directed to this site for more conceptual questions. Here is my issue: Im designing an application that uses CQRS to expose functionality to higher levels in the stack. This looks like below ...
4
votes
2answers
205 views

Is checking that a property doesn't throw an exception a valid unit test?

I'm writing tests for the following class: public class Foo : INotifyPropertyChanged { private int _failCount; private int _totalCount; public double FailRate { get { double ...
-1
votes
4answers
259 views

Is static going to make any difference in this code snippet

I have been to an interview and was asked this question - is there any difference adding or removing the static keyword in these classes? I know what static means but my understanding of this point ...
-1
votes
1answer
52 views

Naming convention for static private fields C# [closed]

I've read many places around the web to use pascalCasing for private instance fields. This makes sense as you can always use "this" when a parameter or local variable has the same name. Do you use ...
1
vote
2answers
75 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 ...
0
votes
1answer
220 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 ...
0
votes
0answers
43 views

async Task method that controls the scheduler it runs on [migrated]

The typical way of writing an async Task method is as follows: public async Task<int> LongCalculationAsync(int arg) { int res = doSomeLongCalculation(); res += await ...
1
vote
2answers
125 views

Smells in exception handling: how to separate between public and internal exceptions?

During the development of a small web API, we decided to separate internal exceptions from public exceptions. Public exceptions are HTTP exceptions, that translate into HTTP responses with proper ...
2
votes
2answers
246 views

Database performance comparison

I have been tasked with moving from a MSSQL backed database, entity framework code-first, wcf service based MVC application to a MySQL backed database. I have had being trying to find a performance ...
1
vote
1answer
793 views

.NET software design and Oracle ODP.NET UDT

I'm working on a new common .NET software design (mainly) for WCF-based web service applications with related client frontends (all written in C#). As far I've chosen some frameworks ...
0
votes
1answer
81 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 ...
13
votes
3answers
615 views

What is the difference between ref and out in runtime?

C# provides the ref and the out keyword to make arguments to be passed by reference. The semantic of the two is very similar. The only difference is in the initialization of the flaged variable: ref ...
0
votes
1answer
110 views

Writing code with language features yet to come in mind

In C#6, we will (most likely) have the nameof operator, a very useful operator for the ArgumentNullException pattern: public void M(T x) { if (x == null) { throw new ...
1
vote
2answers
118 views

Which design (pattern) would be suitable to abstract logging platforms?

I need to create a simple system to abstract logging platforms. The idea is that I'd like to be able to exchange or activate a logging platform (nlog, log4net, enterprise library) via some ...
9
votes
12answers
7k views

Is there a supported way to run .NET 4.0 applications natively on a Mac?

What, if any, are the Microsoft supported options for running C#/.NET 4.0 code natively on the Mac? Yes, I know about Mono, but among other things, it lags Microsoft. And Silverlight only works in a ...
2
votes
3answers
1k views

How to implement Facebook leaderboard game for mobile?

I am in the final stages of developing an indie C# mobile game that I will deploy to iPhones and Androids using Mono. I wish to add push notifications and a Facebook leader board feature into the ...
17
votes
7answers
3k views

Why is instance creation the way it is?

I've learned C# over the course of the past six months or so and am now delving into Java. My question is about instance creation (in either language, really) and it's more of: I wonder why they did ...
-1
votes
1answer
85 views

Would it be troublesome to learn C# and F# at the same time? [duplicate]

I was pondering the idea of learning F# while I learned C#. It isn't my first programming language. I learned Python first and I saw F# and it seemed very much the same. I thought it may be hard to ...
0
votes
3answers
153 views

How to save complex data to file/disk?

I am working on a side project for a small business owner (my father) and part of the requirements for the application include saving customer and job related data in a way that it can easily be ...
0
votes
1answer
180 views

Is it good practice to shorten functions? [duplicate]

Is it good practice to shorten functions? Like this code for instance: using System; namespace Hello { class Program { public static void ...