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

4
votes
2answers
5k views

In MVC where do you put action methods for views in the shared directory?

I have a website built using a MVC.NET framework with C# that uses some shared views and partial views. In order to display the views properly there is a bit of code that must reside in the ...
1
vote
5answers
957 views

How do I get my open-source idea started? [closed]

I have an idea for an open source project. It's about building developing tools for software developers. Yet I have never joined a development team and now I don't know much about these teams except ...
8
votes
6answers
8k views

What naming Convention to Use for C# Function Parameters

There are situations when a name passed in Parameter will be Cast into a new type, but the name of the Passed object should remain similar. For the case of Class Attributes, we can use this operator, ...
7
votes
1answer
273 views

Should I let my users write BnfExpressions to extend my grammar?

Preface I'm designing a templating language (please skip the don't/why?? speech). One of the major goals of this language is to be extensible. There are 2 main elements in my language. "Tags" and "...
2
votes
3answers
743 views

What should I name these methods? [closed]

I have two interfaces, one with and one without generic type parameters. The non-generic interface is used internally so that I can store instances of the generic interface in a collection. All would ...
5
votes
7answers
2k views

Costs of Switching to Java [closed]

I'm a C# dev and I have plans of starting to develop apps targeting Android, which of course means Java. I have heard good things about Mono for Android and the idea of reusing my skill set is ...
14
votes
12answers
2k views

What is the regarded current best practises regarding the “this” keyword in front of field and methods in c#?

Unless it is needed to differentiate between a variable and field with the same name, I never put this. in front of a field or any member access in C#. I see this as no different to m_ prefix that ...
3
votes
2answers
790 views

Has anyone used a Stub in production code?

I have a situation where some procedure returns an object (kind of like a DTO) with a certain interface: interface ISomeInterface { string StringReadOnlyProperty { get; } int ...
5
votes
6answers
4k views

What are good reasons to use explicit interface implementation for the sole purpose of hiding members?

During one of my studies into the intricacies of C#, I came across an interesting passage concerning explicit interface implementation. While this syntax is quite helpful when you need to resolve ...
16
votes
8answers
16k views

Senior Interview LINQ questions [closed]

I'm preparing a LINQ section in interview questions for senior programmers. What are the most interesting questions in LINQ to include? And why?
10
votes
6answers
833 views

Starting new project with TDD

I'm studying TDD and I read that it also helps you to define the design of the app, correct? So I decided to start creating a new project to help me understand it better. I want to create a simple ...
67
votes
6answers
13k 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 ...
8
votes
3answers
1k views

Is it recommendable to program .net apps with C++

From what I can understand, C# is the defacto language when coding .NET apps. Is it recommendable to program .NET apps [let that be ASP.NET, WinPhone 7, GUI, etc] in C++? What are the pitfalls and the ...
3
votes
3answers
477 views

C# Coding Standard - Position of Attribute in relation to Target

I had thought that this was one of the few solved problems in C# coding standards / style; Attributes always appear on the line above the thing to which they are applied a la [SomeClassAttribute] ...
3
votes
4answers
789 views

How do you remember encapsulation types for effective use?

I've been attempting to learn C#.NET for the past month or so, and the array of ideas that seems to always trip me up is encapsulation. As this is one of the three pillars of OOP, I feel that I am ...
0
votes
2answers
444 views

What is the most pragmatic & basic UI pattern to follow for Silverlight and/or WPF

Here is the context. The apps will: consume existing (and standard) web services. app is UI intensive (UI updated frequently and lot of data to display). development team experience level is average....
2
votes
2answers
513 views

What is the best way to store files when using winforms and web?

I have to develop an application (in C#) that has to work with files. The application consists of two versions: a web version and a windows version. Therefore, the files must be stored on a place ...
1
vote
3answers
675 views

Should I keep all my class definitions in the same class library?

I am starting to work with class libraries in my C# class. We were told to write code that can be used more than one time. Should I keep all my class definitions in one class library for the length of ...
7
votes
5answers
6k views

Learning Test Driven Development [closed]

If I want to learn TDD on my own, where would I start apart from the usual Google Search? Are there any books that you would recommend or any method that you followed to learn it on your own? I am ...
10
votes
2answers
8k views

Prefered way to declare events

I am fairly happy with my understanding of the .NET event model. I think I might be misunderstanding a small nuance of the system. When I started out putting events into my classes I would use the ...
22
votes
5answers
13k views

When and why you should use void (instead of e.g. 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 ...
3
votes
1answer
3k views

How to generate nonce for Ajax web requests

As many of you know WordPress uses "secret key" like thing for every AJAX request. Making each request unique and also 'somewhat' secure (just a step ahead than nothing). How would I implement the ...
3
votes
6answers
1k views

“As” Naming Convention [closed]

I'm experimenting with a naming convention I've devised and am seeking opinion. It involves the use of an "As" infix, and at this point I am envisioning it in the context of JavaScript, C# and C++ ...
19
votes
12answers
1k views

What makes documentation good? [duplicate]

I need to write documentation for several projects I worked on. I was wondering what, according to your experience, makes documentation useful and complete. What part should I include, how deep should ...
2
votes
2answers
305 views

An event that raises itself - is it too complicated?

I have a little problem. I'm writing a resource loading and caching system, in which user can request a resource, and set a callback to be called when resource is loaded (and/or wait for load to ...
5
votes
1answer
3k views

What would your DB Schema look like if you are building a Reddit/Digg-like site? [closed]

Just found out something rather interesting about Reddit's database schema: The way we’ve changed is we use an “open schema”. Sometimes it’s called “entity attribute value”. It’s basically ...
3
votes
7answers
755 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
811 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
601 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
682 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
553 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
655 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
614 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
849 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: ...
5
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 ...