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
3answers
8k views

Static class vs Singleton class in C# [duplicate]

Possible Duplicate: What is the difference between all-static-methods and applying a singleton pattern? I need to make a decision for a project I'm working of whether to use static or ...
7
votes
3answers
9k views

What is meant by Scope of a variable?

I think of the scope of a variable as - "The scope of a particular variable is the range within a program's source code in which that variable is recognized by the compiler". That statement is ...
4
votes
1answer
1k views

test for graduate software developer role? [closed]

I'm looking for tests that are suitable for a graduate software developer role, mainly tests that are about reviewing code and finding faults and etc, multiple choice or otherwise.preferably code ...
0
votes
1answer
3k views

Implementing a ILogger interface to log data

I have a need to write data to file in one of my classes. Obviously I will pass an interface into my class to decouple it. I was thinking this interface will be used for testing and also in other ...
4
votes
2answers
585 views

I have a stacktrace and limit of 250 characters for a bug report

I'm developing an xbox indie game and as a last-resort I have a try...catch encompassing everything. At this point if an exception is raised I can get the user to send me a message through the xbox ...
19
votes
3answers
20k views

what is message passing in OO?

I've been studying OO programming, primarily in C++, C# and Java. I thought I had a good grasp on it with my understanding of encapsulation, inheritance and polymorphism (as well as reading a lot of ...
5
votes
3answers
5k views

Why use string.Empty over “” when assigning to a string object

I've been running StyleCop over my code and one of the recommendations SA1122 is to use string.Empty rather than "" when assigning an empty string to a value. My question is why is this considered ...
2
votes
1answer
626 views

Best Practice of making a Composite Control with a repeater activity

Best Practice of making a Composite Control with a repeater activity It's Templated-Based, have paging support via a DropDown and 2 Buttons It should have Event-Handling also Needed to work as a ...
5
votes
5answers
13k views

Efficient methods for storing tens of millions of objects for querying, with a high number of inserts per second?

This is basically a logging/counting application that is counting the number of packets and counting the type of packet, etc. on a p2p chat network. This equates to about 4-6 million packets in a 5 ...
4
votes
7answers
2k views

Changing from VB.NET to C#? [closed]

I am working on co-op at a company as a test engineering specialist. This is not technically a software job, however at the end of the day, I spend most of my time programming. I am not a ...
0
votes
1answer
913 views

Reference public exposed property or private field in other parts of a class [duplicate]

Possible Duplicate: Private variable vs property? I have a public property with a get and set accessor. Associated with this property is a private field. Is it best practice when ...
9
votes
7answers
1k views

Should I be bothered if my LOC/day ratio is too high?

I'm currently working on an indie project, so I don't exactly have the luxury of throughout human testing or external code review — however, I don't see any difficult bugs in my current code (I fix ...
1
vote
3answers
352 views

How I can hide dependencies from my Services?

Here's a service abstraction that I am working on : public abstract class Service { public ILogger Logger{get;set;} public IQueryManager QueryManager{get;set;} public ICommandManager ...
2
votes
3answers
227 views

The false element in a Logical operation

I wish to know if there's some way to know which is the elemnet of a logic operation is false? Example. if( String.IsNullOrEmpty(obj1) || (String.IsNullOrEmpty(obj2) ) throw("..............."); ...
14
votes
8answers
30k views

Dictionary vs List

So I ran into a Dictionary<int, int> today at work. This just seemed weird to me because I would have probably just used a List<int> instead. Is there a difference and would there be a use ...
15
votes
3answers
4k views

Interception vs Injection: a framework architecture decision

There's this framework that I'm helping to design. There are some common tasks that should be done using some common components : Logging, Caching and raising events in particular. I am not sure if ...
0
votes
1answer
520 views

How should I setup a UI for editing a binary tree?

I need to allow the user to create an binary tree. I have a Backbone Model populating properly from the database, the problem I am stuck on is how do I setup the ui elements in a way that is fairly ...
1
vote
2answers
1k views

What programming language would be the best fit for small browser games? [closed]

I want to make small web apps containing little games (multi-user dungeons, tower defense games, and roguelikes) or talent calculators for MMOs etc. After some research I have had people say that ...
1
vote
4answers
5k views

How to Console.WriteLine from [TestMethod]?

I am trying to show some information from a [TestMethod] method. Usually we use NUnit and a line with Console.WriteLine runs fine and we can see it in 'output' window, but on this project we must to ...
-1
votes
1answer
174 views

Industry consortium for wider C# adoption? [closed]

Are there any software consortium to promote C# as a language? I'm aware of Mono and see it as a sincere, valiant attempt. However, its unlikely they can continuously outrun Microsoft inside a ...
6
votes
3answers
405 views

choosing a functional language platform for a new project [closed]

I have been writing code for a few years now and I don't believe I can claim to have a complete knowledge in this job yet. My experience primarily rolls around C# related areas with a decent ...
0
votes
4answers
469 views

Software development project inception phase

Currently our team develops Web Applications and now we are going to Windows Forms applications. I have created the inception phase for our Windows Forms project structure. eg: ApplicationSolution ...
2
votes
2answers
502 views

Is it considered best practice to dynamically bind return types from the Entity context?

MyDbEntities context = new MyDbEntities(); var result = context.StoredProcedureName(userId); In the situation above, is it considered best practice to use var or ObjectResult<ComplexType>?
6
votes
2answers
319 views

Is there a certain number of lines of code to be followed /maintain?

I am developing a software system (Patient Administration System) and I have noticed it already had 451 lines of code(in one namespace). Is this bad? Or does the number of lines of code not matter ...
10
votes
3answers
1k views

Base classes as factories?

I was writing some code over the weekend and I found myself wanting to write a factory as a static method in a base class. My question is simply to know if this is a c# idomatic approach? My sense ...
8
votes
4answers
1k views

What aspects of a project should be covered when presenting it in an interview?

I am working as a .Net developer for a couple of years. I don't have experience in presenting projects but I have an interview and I will be expected to present the projects that I worked on in the ...
1
vote
2answers
1k views

Adding scripting capability to a .NET application

I already have a working implementation that adds scripting to an application. The application currently generates and compiles scripts from C# snippets (taken from different user provides ...
1
vote
6answers
8k views

IF ELSE shorthand. Does it hurt readability [duplicate]

Possible Duplicate: Is the ternary operator evil? Does using shorthand if else statments hurt readability? Compare: string name = street != null ? street.Owner : "Not known"; With: ...
6
votes
4answers
3k views

How to ensure a single coding standard in .NET with tool support

Probably, the basic situation is familiar to everyone. You have agreed on certain coding standards in your team and now it is time to make sure that everybody follows them. Some do it via heavy ...
4
votes
8answers
3k views

How can I move a team from C# ASP.NET development to PHP development using Drupal?

I have a team of skilled C# developers with vast experience in creating ASP.NET MVC applications. We will soon be starting a new big web site project based on the Drupal platform. My developers do not ...
2
votes
1answer
148 views

Testing chainable method calls return type and value

Is it worth testing the return type and value of a method call that is designed for chaining? It is conceivable that a fellow programmer could accidentally change the return type to void and remove ...
66
votes
17answers
12k views

Coding Guideline : Methods shouldn't contain more than 7 statements?

I was looking through the AvSol Coding Guidelines for C# and I agree with nearly everything but I'm really curious to see what other think of one specific rule. AV1500 Methods should not ...
8
votes
4answers
8k views

Business Objects within a Data Access Layer

So I've been creating a data access layer via TDD and have approached somewhat of a concern. I'd rather not start down the wrong path, so I figured I'd ask you guys to see if my thoughts were in line ...
1
vote
1answer
2k views

Encapsulating a class within another class to hide its exposed properties and details

I have essentially a data model class that represents an XML data structure that we use to model our system. The model class is in a shared project that is used by a number of different solutions in ...
12
votes
11answers
7k views

Examples of operator overloading, which make sense

While I learning C#, I found that, the C# supports operator overloading. I have problem with good example which: Make sense (ex. adding class named sheep and cow) Is not an example of concatenation ...
2
votes
1answer
2k views

Object orientated data structures in database driven applications

I've started working for a company that maintains a small/medium sized commercial website. The website is written in c# asp.net, and uses SQL Server as a database. The structure of the code is very ...
21
votes
4answers
6k views

What's the difference between implementing an Interface explicitly or implicitly?

In Visual Studio I can right-click on an interface and choose to Implement Interface, or Implement Interface Explicitly. public class Test : ITest { public string Id // Generated by Implement ...
11
votes
3answers
989 views

How can I unit test audio?

I have inherited a small project and want to extend it and stabilize it at the same time by writing Unit Tests for all the new code I am adding. The first class, TypedAudioCreator, creates audio files ...
5
votes
3answers
1k views

Best example for mixins in .NET [closed]

I want to present the concept of mixins and their implementation in .NET. The way they work in .NET is you add extension methods on an interface and decorate classes with said interface. What would ...
19
votes
2answers
13k views

Separating data access in ASP.NET MVC

I want to make sure I'm following industry standards and best practices with my first real crack at MVC. In this case, it's ASP.NET MVC, using C#. I will be using Entity Framework 4.1 for my model, ...
-2
votes
5answers
1k views

Organizing single page code well with Notepad++

I've a c# file that will contain, most likely 10,000+ lines of code. I'd like to break this file into tabbed segments, so I can organize each method into a certain tab and label the tab something like ...
5
votes
3answers
393 views

Extending Mono's C# compiler with additional custom features (more or less syntactic sugar)

I'm aware that this is a rather broad question, but here it goes anyway... What is, in your opinion, the most practical way to create own C# implementation with minor additions to the existing 4.0 ...
2
votes
1answer
661 views

Sanity of design for my in-memory object representations of database rows

I've been trying to revise the structural design of the C#.NET-based system I'm currently working on. The new design involves a rather light-weight object-relational mapping framework (we're trying ...
11
votes
4answers
2k views

Shortcomings of using dynamic types in C#

I have been recently studying more on the dynamic types in C#. With some examples I understood once the code is compiled, it does not need to be recompiled again but can be executed directly. I feel ...
6
votes
2answers
444 views

Delegates and events

What is the difference between public delegate void SecondChangedHandler(Object clock, TimeInfoEventArgs ti); public event SecondChangedHandler OnSecondChanged; and public event ...
9
votes
2answers
421 views

Imitating Exchange Server's “RBAC AuthZ” in my own application… (is there something similar?)

Exchange 2010 has a delegation model where groups of winrm cmdlets are essentally grouped into roles, and the roles assigned to a user. (Image source) This is a great & flexible model ...
2
votes
2answers
289 views

Putting it all together [closed]

I've been reading a few books on c# development over the last few months (clr via c#, architecting applications for the enterprise, c# 4 in nutshell just to give you an idea). I really feel it's been ...
3
votes
3answers
610 views

How to structure an application which reads UPC barcodes

I have no previous experience on creating a project for a seller which will use barcode reader. I am trying to put together a small project but I cannot figure out how the pieces should glue together. ...
1
vote
1answer
225 views

Team Parallel development in ASP.NET

I am developing an application written in ASP.NET (C#) which heavily use on Master Page and Session. As there will be enhancement in the same web application, and will be done by my teammate. is ...
3
votes
4answers
625 views

What factors should I consider when choosing names for identifiers?

What factors do I need to consider when choosing names for identifiers such as variables? I am concerned about space issues, i.e. extra memory consumption when choosing longer names. As an example, ...