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

3
votes
7answers
751 views

Is the rule of 10% code is comments still valid?

I've used some older languages before C# and I always felt the need to comment what I was doing so it is clear for anyone who reads the code. But now that I use C# decently, I often feel that it's a ...
16
votes
9answers
3k views

Will Java catch up with C#? [closed]

Today I posted a question asking about which language C# or Java would be better for me to study. I had some great answers. One thing that came up was that perhaps Java is now rather behind C# with ...
5
votes
7answers
464 views

Is there a way to play the role of Javascript with any other language like C#? [closed]

Is there a way to play the role of Javascript with any other language like C#? One way came up in my head is, having silverlight installed, using C# instead of Javascript for all the client side ...
0
votes
1answer
803 views

Building a table (DataGridView) while keeping decoupled from Model

I'll try to keep this simple. Small C# app, dialog based, one has a DataGridView. I've got an UpdateTable function in the form that accepts a DataSet and passes it to the DataGridView.DataSource. &...
9
votes
11answers
4k views

What is the point of properties?

Here are some arguments for properties and my counter-arguments: Easier to use than writing getter and setter methods Getter and setter method pairs are a code smell. Making it easier to write ...
10
votes
2answers
600 views

Which GOF design patterns are already implemented as first-class language features in C#?

(This question was closed on Stack Overflow due to being "too broad" and "not a real question" so maybe it's more appropriate here?) Inspired by this question. We know events are a language-level ...
3
votes
6answers
5k views

C# Unit Testing In A Single Project

Alright, so I'm doing my first "real" C# project. I'm chugging along, enjoying myself, nice little language I've got here, fairly easy to use, la ti da. Then I get to the point that I realize there'...
12
votes
6answers
679 views

Open Source Etiquette

I've started working on my first open source project on Codeplex and came across some terrible code. (I did learn that C# still has the "goto" statement) I started adding features that the "owner" ...
2
votes
2answers
2k views

Resources or advice useful coming to C# from python 2.7.1 [closed]

I'm a python monkey at heart. I eat drink sleep and dream in it, and have found that it's taught me much more about writing quality code than my degree in Computer Science ever did, however I've been ...
3
votes
1answer
549 views

Merging functionality from two controllers; should I place all actions in one controller?

Say I have 2 controllers, OrderController and StatusController. OrderController has several CRUD actions for Orders and StatusController has several actions pertinent to changing the satus of Orders (...
-1
votes
1answer
2k views

Which are C# 4.0 programming paradigms? [closed]

Which are C# 4.0 programming paradigms? In what category does extension methods fall into? A programming language can support multiple paradigms. For example, programs written in C++ or ...
3
votes
2answers
1k views

Designing tool for C#

I have seen few developers use a tool for designing their application where they simply dragged needed elements (classes, variables, objects) and just did magic work. Then there was a button to ...
7
votes
2answers
1k views

Shifting between XML schemas and C# classes in a sensible fashion

A .NET/C# system receives XML messages for processing and further transmission. Since working directly on XML documents would be very inconvenient, it is necessary to deserialize the message to a C# ...
23
votes
7answers
10k views

How far should 'var' and null coalescing operator '??' be entertained without hampering readability?

I know the title of the question is very subjective, but I was confronted with usage of ?? operator by my peers, where at the same time I was not very happy/comfortable with applying var in new up-...
11
votes
2answers
1k views

How can I use my coding skills for good?

By this autumn my two small websites should be generating around a total of $1200 a month with minimal/zero input which is enough to for me to live on comfortably enough. Rather than embark on ...
17
votes
9answers
652 views

Should if statments be in inner or outer method?

Which of these designs is better? What are the pros and cons of each? Which one would you use? Any other suggestions of how to deal with methods like is are appreciated. It is reasonable to assume ...
4
votes
2answers
6k views

ASP.NET MVC 3 (C#) Software Architecture

I am starting on a relatively large and ambitious ASP.NET MVC 3 project and just thinking about the best way to organize my code. The project is basically going to be a general management system that ...
5
votes
1answer
606 views

Have any of you used MEF to configure Castle Windsor

I am thinking of using MEF to manage the fluent interface on Castle Windsor. Allowing for me to swap out different sections of the system for test and production. Has anyone done this if so how well ...
5
votes
7answers
846 views

Design Code Outside of an IDE?

Does anyone design code outside of an IDE? I think that code design is great and all but the only place I find myself actually design code (besides in my head) is in the IDE itself. I generally ...
2
votes
4answers
3k views

Should I be learning Linq, Direct SQL Commands (in .net), EF or other? [closed]

Basically, I have a very good knowledge of plain old SQL coming from Classic ASP programming. Over the past couple of months, I have been learning C# and today was my first full day at MVC 3 (Razor) ...
6
votes
6answers
2k views

Adding to the System namespace in C#

Would it be acceptable for some very generic utilities or classes to be added in the System namespace? I'm thinking of really basic stuff like a generic EventArgs (EventArgs<T>), Use case: ...
4
votes
9answers
3k views

Which is better: many class definitions in the same file or every class definition in a separate file?

Which is better: many class definitions in same file or every class definition in separate file? Examples: 1) Many classes in same file. Say, myManyClasses.cs: namespace myPack { class myClass1(...
14
votes
3answers
2k views

Could a singleton type replace static methods and classes? [duplicate]

Possible Duplicate: What is the difference between all-static-methods and applying a singleton pattern? In C# Static methods has long served a purpose allowing us to call them without ...
7
votes
3answers
1k views

How can I reduce the amount of time it takes to fully regression test an application ready for release?

An app I work on is being developed with a modified version of scrum. If you are not familiar with scrum, it's just an alternative approach to a more traditional watefall model, where a series of ...
4
votes
2answers
199 views

Is it better to load up a class with methods or extend member functionality in a local subclass?

Which do you like better? Class #1: public class SearchClass { public SearchClass (string ProgramName) { /* Searches LocalFile objects, handles exceptions, and puts results into m_Results. */...
4
votes
2answers
742 views

How can large data handling be a special requirement for job?

I chanced to see some job requirements of Oracle SQL programmer or C# developer jobs, who want a person who can handle terabytes of data in ETL or data migration. I have worked on data migration to ...
11
votes
4answers
1k views

How far to go with unit tests

A question asked many times before but with a specific slant twds mvc development. I've been a very good boy and have been coding all my controller actions with corresponding unit tests which has ...
15
votes
7answers
146k views

Game programming : C# or C++? [closed]

I've decided what I really want is to do game programming. So the question is, as a 18 years old who wants to learn self taught programming, what is the most suited programming language between C# and ...
7
votes
4answers
959 views

Solo vs Team development and the consequences

I've been programming for a while on different languages. I never really studied programming at school nor worked on a team of more than two people (me included). Still, I've been a professional ...
8
votes
4answers
11k views

I want to master ASP.NET - What concepts should I focus on/What concepts do you most value? [closed]

I start a job this summer doing work in ASP.NET 4 (C#). I plan on working with some legacy code as well as MVC. I want to get a running start. I have good understanding of HTML/CSS/Javascript, and ...
3
votes
3answers
1k views

Entity Framework limitation

I was wondering if anyone had the same need and why (if possible). My problem is: I can't create a model in EF using two tables from different DBs without some weird workarounds. For my scope that ...
1
vote
2answers
430 views

Keeping application backend and UI synchronised

I have an app that works with a list of objects so has one central keyed list. The main window has a tree containing these object with some information, which is easy enough to populate as a one off ...
18
votes
6answers
4k views

What is the philosophy/reasoning behind C#'s Pascal-casing method names?

I'm just starting to learn C#. Coming from a background in Java, C++ and Objective-C, I find C#'s Pascal-casing its method-names rather unique, and a tad difficult to get used to at first. What is the ...
36
votes
10answers
11k views

WPF vs. WinForms - a Delphi programmer's perspective?

I have read most of the major threads on WPF vs. WinForms and I find myself stuck in the unfortunate ambivalence you can fall into when deciding between the tried and true previous tech (Winforms), ...
22
votes
6answers
24k views

Multiple classes in a single .cs file - good or bad? [closed]

Is it advisable to create multiple classes within a .cs file or should each .cs file have an individual class? For example: public class Items { public class Animal { } public class ...
131
votes
17answers
41k views

Are #regions an antipattern or code smell?

C# allows the use of #region/#endregion keywords to make areas of code collapsible in the editor. Whenever I do this though I do it to hide large chunks of code that could probably be refactored into ...
3
votes
2answers
623 views

Should I migrate to MVC3?

I have a MVC2 project, my question is: should I migrate to MVC3? Why? I'd like the opinion of some who already migrated, or at least used MVC3 and MVC2. Already read http://weblogs.asp.net/scottgu/...
11
votes
10answers
34k views

Real world use of C# Delegates [closed]

I think that I conceptually understand C# delegates, however, I am struggling to find a real world example where they would be useful. Can you provide some answers detailing how C# delegates were ...
0
votes
3answers
715 views

Fast lookup for organization hierarchy

I need a way to implement a fast lookup algorithm / system to find users very quickly in a multi-level department and multi-level employee/manager relation organization structure. Departments can ...
32
votes
11answers
21k views

Java vs. C# - Productivity perspective [closed]

If you have a number of years experience in working with Java and a number of years experience in working with C# and .NET, I would value your opinion on software development productivity differences ...
4
votes
5answers
1k views

Developer productivity Cobol versus C#

We are doing a cost benefit analysis on a migration project. It would be nice to be able to say that future changes will be x percent cheaper due to the migration. Does anyone have any experience or ...
23
votes
10answers
16k views

Constructor parameter validation in C# - Best practices

What is the best practice for constructor parameter validation? Suppose a simple bit of C#: public class MyClass { public MyClass(string text) { if (String.IsNullOrEmpty(text)) ...
4
votes
1answer
1k views

Is ViewModel with more than one repository bad?

I'm working on a project with MVVM. Some ViewModels have more than one repository. Is ViewModels with more than one repository bad? Please provide with why it's good/bad.
6
votes
15answers
3k views

Why OOP is enforced in Java and C#? [closed]

In many other languages like C++ and Javascript, OOP is optional. Procedural code is ok. But in languages like Java and C#, OOP is somewhat enforced. Everything is to be a part of a class or an object....
2
votes
5answers
4k views

Conways Game of Life C#

Not sure if this is the correct place for this question or SO - mods please move if necessary. I am going to have a go at creating GoL over the weekend as a little test project : http://en.wikipedia....
13
votes
6answers
4k views

Convert from Procedural to Object Oriented Code

I have been reading Working Effectively with Legacy Code and Clean Code with the goal of learning strategies on how to begin cleaning up the existing code-base of a large ASP.NET webforms application. ...
7
votes
5answers
62k views

C# Multithreading Interview questions for a senior developer/designer position

I wonder what sort of interview questions were asked to a senior developer or technical consultant on multithreading. Kindly provide me some of the interview questions which were asked in the ...
1
vote
3answers
260 views

Addressing a variable in VB

Why doesn't Visual Basic.NET have the addressof operator like C#? In C#, one can int i = 123; int* addr = &i; But VB has no equivalent counter part. It seems like it should be important. ...
3
votes
3answers
1k views

Interop Best Practices: Should I use Static Class, or Normal Classes

I have a front end C# that needs to call a C++ back end. So interop is needed. I have an "interop layer", that converts the C# data structure into C++ structure, and do all the memory freeing grunt ...
5
votes
2answers
1k views

what is a proper way to register eventHandler

I was showing some of my code to a junior programer, and he asked me why am I registering functions for event handling like this: button1.Click += new RoutedEventHandler(button1_Click); and not ...