Click here to Skip to main content
15,891,316 members
Home / Discussions / C#
   

C#

 
QuestionAnother method safer than StreamWriter and how can I save the file on another server (asp.net c sharp) Pin
aspkiddy7-Oct-09 6:32
aspkiddy7-Oct-09 6:32 
QuestionCode Readability Poll Pin
LimitedAtonement7-Oct-09 5:57
LimitedAtonement7-Oct-09 5:57 
AnswerRe: Code Readability Poll Pin
Kevin Marois7-Oct-09 6:34
professionalKevin Marois7-Oct-09 6:34 
GeneralRe: Code Readability Poll Pin
N a v a n e e t h7-Oct-09 7:38
N a v a n e e t h7-Oct-09 7:38 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 8:22
mvePIEBALDconsult7-Oct-09 8:22 
GeneralRe: Code Readability Poll Pin
Gideon Engelberth7-Oct-09 9:14
Gideon Engelberth7-Oct-09 9:14 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 13:49
mvePIEBALDconsult7-Oct-09 13:49 
AnswerRe: Code Readability Poll Pin
Luc Pattyn7-Oct-09 6:40
sitebuilderLuc Pattyn7-Oct-09 6:40 
Hi,

IMO readability is very important; it helps in getting correct code that is easily maintained.
Code generated and performance tend to be equal or better when you improve readability.


LimitedAtonement wrote:
Insets insets = obj as Insets;
if (ReferenceEquals(insets, null)) return false;
return ((top == insets.top) && (left == insets.left) && (bottom == insets.bottom) && (right == insets.right));


I seldom use "is", often "as", hardly ever ReferenceEquals, hence:

Insets insets=obj as Insets;
return insets!=null && insets.top==top && insets.left=left && insets.bottom==bottom && insets.right==right;



LimitedAtonement wrote:
foreach (Point a in _gr_pts)
{
if (prev == Point.Empty || prev == a)
{
prev = a;
continue;
}
g.DrawArc(_ap_pen, prev, a);
prev = a;
}


isn't that just:
foreach (Point a in _gr_pts)  {
    if (prev!=Point.Empty && prev!=a) g.DrawArc(_ap_pen, prev, a);
    prev=a;
}


You may have noted:
- I skip most irrelevant spaces
- I use "East Coast brackets", i.e. they open without a new line
- I use parentheses even when not needed to make sure about operator precedence but only if you could be mistaken.
- I don't use negative if conditions, unless there is no else, or the negative block is much much shorter than
the positive block (as in if (!OK) {throw} else {lots of code})

Smile | :)

Luc Pattyn

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages

Local announcement (Antwerp region): Lange Wapper? Neen!


GeneralRe: Code Readability Poll Pin
Ennis Ray Lynch, Jr.7-Oct-09 8:59
Ennis Ray Lynch, Jr.7-Oct-09 8:59 
GeneralRe: Code Readability Poll Pin
Luc Pattyn7-Oct-09 9:14
sitebuilderLuc Pattyn7-Oct-09 9:14 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 12:58
mvePIEBALDconsult7-Oct-09 12:58 
AnswerRe: Code Readability Poll Pin
N a v a n e e t h7-Oct-09 6:42
N a v a n e e t h7-Oct-09 6:42 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 7:32
mvePIEBALDconsult7-Oct-09 7:32 
GeneralRe: Code Readability Poll Pin
N a v a n e e t h7-Oct-09 7:42
N a v a n e e t h7-Oct-09 7:42 
GeneralRe: Code Readability Poll Pin
DaveyM697-Oct-09 9:08
professionalDaveyM697-Oct-09 9:08 
GeneralRe: Code Readability Poll Pin
LimitedAtonement7-Oct-09 10:02
LimitedAtonement7-Oct-09 10:02 
GeneralRe: Code Readability Poll [modified] Pin
DaveyM697-Oct-09 11:12
professionalDaveyM697-Oct-09 11:12 
AnswerRe: Code Readability Poll Pin
Not Active7-Oct-09 6:44
mentorNot Active7-Oct-09 6:44 
GeneralRe: Code Readability Poll Pin
Kevin Marois7-Oct-09 6:53
professionalKevin Marois7-Oct-09 6:53 
GeneralRe: Code Readability Poll Pin
N a v a n e e t h7-Oct-09 7:24
N a v a n e e t h7-Oct-09 7:24 
GeneralRe: Code Readability Poll Pin
Not Active7-Oct-09 7:53
mentorNot Active7-Oct-09 7:53 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 7:54
mvePIEBALDconsult7-Oct-09 7:54 
GeneralRe: Code Readability Poll Pin
LimitedAtonement7-Oct-09 7:32
LimitedAtonement7-Oct-09 7:32 
GeneralRe: Code Readability Poll Pin
Not Active7-Oct-09 8:01
mentorNot Active7-Oct-09 8:01 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 8:07
mvePIEBALDconsult7-Oct-09 8:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.