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

35
votes
7answers
24k views

When to use abstract classes instead of interfaces with extension methods in C#?

"Abstract class" and "interface" are similar concepts, with interface being the more abstract of the two. One differentiating factor is that abstract classes provide method implementations for derived ...
15
votes
8answers
6k views

Do I need a degree in Computer Science to get a junior Programming job? [closed]

Do I need to go to Uni to get a job as a Junior C# coder? I'm 26 and have been working in Games (Production) for 6 years and I am thinking of a change, I've had exposure to VB6, VBA, HTML, CSS, PHP, ...
0
votes
1answer
2k views

How much do i need to learn in order to get an entry level asp.net job? [duplicate]

Possible Duplicate: If you develop with ASP.NET, which other technologies do you use? I'm currently learning C#, but I've noticed that there is a lot of demand for ASP.NET developers. I ...
48
votes
12answers
5k views

Did the developers of Java consciously abandon RAII?

As a long-time C# programmer, I have recently come to learn more about the advantages of Resource Acquisition Is Initialization (RAII). In particular, I have discovered that the C# idiom: using (var ...
57
votes
8answers
31k views

How do you organize your projects? [closed]

Do you have any particular style of organizing projects? For example, currently I'm creating a project for a couple of schools here in Bolivia, this is how I organized it: TutoMentor (Solution) ...
44
votes
11answers
42k views

For what reasons should I choose C# over Java and C++?

C# seems to be popular these days. I heard that syntactically it is almost the same as Java. Java and C++ have existed for a longer time. For what reasons should I choose C# over Java and C++?
49
votes
8answers
46k 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 ...
38
votes
12answers
2k views

Should a developer always use version control [duplicate]

Possible Duplicate: Version control for independent developers? I've heard statements to the effect of: "Well it's just me working on this project so I don't need to put it under source ...
23
votes
6answers
2k views

How do you encode Algebraic Data Types in a C#- or Java-like language?

There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as: data ConsList a = Empty | ConsCell a (ConsList a) consmap f ...
31
votes
5answers
2k views

I'd like to write an “ultimate shuffle” algorithm to sort my mp3 collection

I'm looking for pseudocode suggestions for sorting my mp3 files in a way that avoids title and artist repetition. I listen to crooners - Frank Sinatra, Tony Bennett, Ella Fitzgerald etc. singing old ...
-1
votes
4answers
2k views

Is there a canonical book for learning C# from scratch? [closed]

I was looking for a good C# book for beginners to learn the language fundamentals and OOP fundamentals, however, every book I have looked at seems to start quickly and does not touch the fundamentals ...
41
votes
8answers
3k 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 ...
51
votes
16answers
6k views

Are #regions an antipattern or code smell?

In C# code it allows the #region/#endregion keywords to made areas of code collapsible in the editor. Whenever I am doing this though I find it is to hide large chunks of code that could probably be ...
38
votes
6answers
7k views

Single Responsibility Principle - How Can I Avoid Code Fragmentation?

I'm working on a team where the team leader is a virulent advocate of SOLID development principles. However, he lacks a lot of experience in getting complex software out of the door. We have a ...
9
votes
4answers
1k views

Should I be a professional in C# programming in order to build good web applications using ASP.NET?

I do not know if there is special programming in C# for the web or it is the same?. If it is the same then what are the topics that I should focus on in C# in order to use it building web application ...
1
vote
0answers
339 views

Understanding interfaces [duplicate]

Possible Duplicate: When to use abstract classes instead of interfaces and extension methods in C#? Why are interfaces useful? What is the point of an interface? What other reasons are ...
41
votes
5answers
13k views

for vs. foreach vs. LINQ

When I write code in Visual Studio, ReSharper (God bless it!) often suggests me to change my old-school for loop in the more compact foreach form. And often, when I accept this change, ReSharper goes ...
36
votes
8answers
13k views

Is static universally “evil” for unit testing and if so why does resharper recommend it?

I have found that there are only 3 ways to unit test (mock/stub) dependencies that are static in C#.NET: Moles TypeMock JustMock Given that two of these are not free and one has not hit release ...
27
votes
8answers
7k views

Private variable vs property?

When setting a value to a variable inside of a class most of the time we are presented with two options: private string myValue; public string MyValue { get { return myValue; } set { myValue = ...
15
votes
5answers
3k views

When and why you should use void (instead of i.e. bool/int)

I occasionally run into methods where a developer chose to return something which isn't critical to the function. I mean, when looking at the code, it apparently works just as nice as a void and after ...
17
votes
7answers
5k 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 ...
3
votes
1answer
638 views

How to refactor a method which breaks “The law of Demeter” principle?

I often find myself breaking this principle (not intentially, just through bad design). However recently I've seen a bit of code that I'm not sure of the best approach. I have a number of classes. ...
6
votes
3answers
432 views

Is structural typing in a hierarchical model necessary?

This is part of a series of questions which focuses on a project called the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. Another ...
5
votes
2answers
420 views

Unit test SHA256 wrapper queries

I have the following SHA256 wrapper. public static string SHA256(string plainText) { StringBuilder sb = new StringBuilder(); SHA256CryptoServiceProvider provider = new ...
79
votes
11answers
19k 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 ...
49
votes
5answers
21k views

When do you use a struct instead of a class?

What are your rules of thumb for when to use structs vs. classes? I'm thinking of the C# definition of those terms but if your language has similar concepts I'd like to hear your opinion as well. I ...
69
votes
16answers
9k views

Do the young minds need to learn the pointer concepts?

Why did the C master Dennis Ritchie introduce pointers in C? And why did the other programming languages like VB.NET or Java or C# eliminate them? I have found some points in Google, and I want to ...
52
votes
6answers
6k views

When to go Fluent in C#?

In many respects I really like the idea of Fluent interfaces, but with all of the modern features of C# (initializers, lambdas, named parameters) I find myself thinking, "is it worth it?", and "Is ...
19
votes
12answers
2k views

How to teach Exception Handling for New Programmers?

How do you go about teaching Exception Handling to Programmers. All other things are taught easily - Data Structures, ASP.NET, WinForms, WPF, WCF - you name it, everything can be taught easily. With ...
39
votes
14answers
5k views

Why are /// comment blocks important?

Someone once said we should prefix all our methods with the /// <summary> comment blocks (C#) and I am wondering if that is true or not. I started to use them and found they annoyed me quite a ...
20
votes
25answers
11k views

How many lines of code can a C# developer produce per month? [closed]

An executive at my workplace asked me and my group of developers the question: How many lines of code can a C# developer produce per month? An old system was to be ported to C# and he would ...
12
votes
4answers
13k views

What are the differences among the .NET certification exams? [closed]

I am a .NET developer using WPF and ASP.NET MVC and I was hoping to pass some kind of certification exam. There seems to be four exams but I am unable to understand what the differences are even ...
8
votes
10answers
16k 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 ...
28
votes
7answers
6k views

Return magic value, throw exception or return false on failure?

I sometimes end up having to write a method or property for a class library for which it is not exceptional to have no real answer, but a failure. Something cannot be determined, is not available, not ...
24
votes
5answers
7k views

MonoTouch vs Objective-C for iPhone/iPod/iPad development [closed]

For someone with .Net experience and wanting to develop for iPhone/iPod/iPad, is it worth learning Objective-C? Is MonoTouch a good alternative? What are some of the trade-offs when using MonoTouch vs ...
25
votes
9answers
6k views

Is catching general exceptions really a bad thing?

I typically agree with most code analysis warnings, and I try to adhere to them. However, I'm having a harder time with this one: CA1031: Do not catch general exception types I understand the ...
14
votes
10answers
6k views

Should we choose Java over C# for a new project? [duplicate]

We have a team of .NET developers (C#) with a range of experience from 2 to 6 years. Over the last few years we have been developing Silverlight, ASP.NET MVC, and WPF applications. However, there is a ...
10
votes
2answers
681 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 ...
4
votes
3answers
11k views

Where can I start learning to build web applications in C# [closed]

So far I've written web sites in PHP, except for a pet project of mine written in Python. I'd like to start learning C# for use on the web, but I have no idea where to start. I know nothing of .Net. ...
16
votes
4answers
1k views

Is there a canonical source for learning C# and .NET internals?

I have been a C++ programmer for last several years with a bit of C# here and there. In my latest job, I work heavily on C#. I picked most of my C# by following the code-base or random google searches ...
3
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 ...
13
votes
7answers
2k views

Why is closure important for JavaScript?

C#'s lambda expression also has closures but is rarely discussed by the C# communities or books. I see far more JavaScript people and books talk about its closures than they do in the C# world. Why is ...
4
votes
2answers
248 views

Alternatives to type casting in your domain

In my Domain I have an entity Activity which has a list of ITasks. Each implementation of this task has it's own properties beside the implementation of ITask itself. Now each operation of the ...
4
votes
4answers
852 views

Why are public and private accessors considered good practice? [duplicate]

Possible Duplicate: When are Getters and Setters Justified Why exactly is having public and private accessors like these: private string foo; public string Foo { get { ...
15
votes
14answers
2k views

Explaining interfaces to beginning programmers?

I've had discussions with other programmers on interfaces (C#). I tried to use the analogy of interfaces being like a contract between programmers. Meaning that when you design to an interface, you ...
9
votes
5answers
2k views

Would you rather make private stuff internal/public for tests, or use some kind of hack like PrivateObject?

I am quite a beginner in code testing, and was an assert whore before. One thing worrying me in unit testing is that is often requires you to make public (or at least internal) fields that would have ...
8
votes
4answers
638 views

Is it useful to unit test methods where the only logic is guards?

Say I have a method like this: public void OrderNewWidget(Widget widget) { if ((widget.PartNumber > 0) && (widget.PartAvailable)) { ...
6
votes
11answers
3k views

Learning C, C++ and C# [duplicate]

I'm sure you guys are tired of this question but after wading through hours of similar posts and questions I've really not made any progress to my specific concerns. I was hoping you guys could shed ...
4
votes
3answers
1k views

Is it bad practice to use public fields? [duplicate]

Possible Duplicate: When are Getters and Setters Justified Why are public and private accessors considered good practice? In my time as developer I learned that properties can be very ...
4
votes
5answers
483 views

Bridging the gap between learning language fundamentals and actually making useful software?

I'm learning C# via the "Essential C#" Lynda.com video tutorials and plan to read a couple of books that cover things in more depth afterwards. My question is where I should head to learn more after ...