Tagged Questions
2
votes
3answers
380 views
When are chained assignments (i.e. a=b=c) bad form?
I'm working on a VB.Net WinForms project and found myself writing code like this:
this.Fizz.Enabled = this.Buzz.Enabled = someCondition;
I couldn't decide whether that was bad code or not. Are ...
6
votes
1answer
147 views
Naming of related classes and interfaces
I have created an ObjectParser class which parses data into strongly typed objects using an IObjectParserDataSource as the data source (the data could be an Excel file, text file, array, query string, ...
2
votes
3answers
404 views
Microsoft's coding standards for ASP.NET controls
I cannot find any naming standards/conventions in MSDN for naming ASP.NET controls.
One of the following standards tends to be used by programmers:
lblAddress
AddressLabel
Address
According to ...
7
votes
7answers
971 views
Prevent developers from using constants
I have one one software system which allows developers to specify an ID or name to create NodeReferences. Both work fine, but ID's are not guaranteed to be the same across different environments. I've ...
1
vote
2answers
317 views
coding style for If condition [duplicate]
I came across below style of writing if statements in C#, on msdn code examples. Usually when I write if statements, the conditions I would write `(Customer != null)
I want to know if there is any ...
10
votes
4answers
434 views
Always pull out common cases and branch separately? [duplicate]
We had a disagreement in a code review.
What I had written:
if(unimportantThing().isGood && previouslyCalculatedIndex != -1)
{
//Stuff
}
if(otherThing().isBad && ...
1
vote
1answer
233 views
Capitalization convention for C# protected fields
What is the capitalization conventions for protected field names in C#?
Is it _myVar (like private field) or MyVar (like properties)?
5
votes
4answers
448 views
C# coding standards” Use the const directive only on natural constants
I've seen these 2 guidelines in coding c# standard and I’m not sure the what the 2nd one means.
With the exception of zero and one, never hard-code a numeric value; always declare a constant ...
4
votes
3answers
138 views
Where do I place my example implementations in my framework?
I've created a pretty simple templating framework and have default implementations for some of my interfaces used for passing around information. I store these in MyFramework.Default namespace
...
7
votes
3answers
1k views
Can someone explain to me C#'s coding convention?
I recently started working with Unity3D and primarily scripting with C#. As, I normally program in Java, the differences aren't too great but I still referred to a crash course just to make sure I am ...
3
votes
1answer
394 views
Has anyone thoroughly compared C# common coding standards?
Most of the C# programmers I know embrace one of the common coding standards. However being aware of the standards is one thing, telling the differences is another.
Browsing the common coding ...
12
votes
8answers
605 views
Are naming convention guidelines worth caring about?
I name my variables using the .Net conventions:
camelCase for variables and fields (I tend to use _camelCase for private fields in a class)
PascalCase for methods, properties and classes
The only ...
2
votes
3answers
255 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]
...
9
votes
9answers
412 views
Studies on code documentation productivity gains/losses
After much searching, I have failed to answer a basic question pertaining to an assumed known in the software development world:
WHAT IS KNOWN:
Enforcing a strict policy on adequate code ...
6
votes
4answers
165 views
Is there a standard for when you include libraries or not?
I often come across a class which has a single reference to another library and was wondering if its better to include the library or to reference the object by it's full name. Is one better then the ...