Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# coding style question Pin
BillWoodruff6-Sep-13 6:02
professionalBillWoodruff6-Sep-13 6:02 
GeneralRe: C# coding style question Pin
MarkRHolbrook6-Sep-13 6:09
MarkRHolbrook6-Sep-13 6:09 
GeneralRe: C# coding style question Pin
BillWoodruff6-Sep-13 5:51
professionalBillWoodruff6-Sep-13 5:51 
GeneralRe: C# coding style question Pin
Nicholas Marty5-Sep-13 3:26
professionalNicholas Marty5-Sep-13 3:26 
GeneralRe: C# coding style question Pin
BillWoodruff5-Sep-13 18:32
professionalBillWoodruff5-Sep-13 18:32 
GeneralRe: C# coding style question Pin
Nicholas Marty5-Sep-13 20:54
professionalNicholas Marty5-Sep-13 20:54 
GeneralRe: C# coding style question Pin
BillWoodruff6-Sep-13 4:35
professionalBillWoodruff6-Sep-13 4:35 
GeneralRe: C# coding style question Pin
Nicholas Marty6-Sep-13 5:15
professionalNicholas Marty6-Sep-13 5:15 
Hey Bill

BillWoodruff wrote:
I am curious now: in what circumstances have you ever used a static class, struct, or fields, or method, defined in the scope of a Form's class, and either made it private by declaring it private, or let it become private by default when you left off the access-modifier ?

There are things where it makes sense to declare something as private static. And I guess if you let it default let it become private or you explicitly declare it as private is just a preference... Where mine is to explicitly tell me and everyone else which visibility I am aiming for (private, internal, protected or public).

In our code the tracer for Log4net is declared as such. Because you want to be able to log in both static and non-static methods through it, but you don't want any other class to log through that same logger.

So in this case: The tracer instance of the form is declared as private static. So you're able to use the tracer in methods of the form to log information. Sure, as long as you don't need static methods in the form class you could also declare it without the static modifier. However the tracer is declared in every class in the same manner so why bother to change it and change it back when you happen to use the instance in a static method?

I don't know about other usages for such a thing on top of my head but I guess there might be some Wink | ;)

BillWoodruff wrote:
fyi: I went into ReSharper 8, and changed the modifier list so 'internal was at the top of the list. Declaring a static boolean variable in a Form: ReSharper 8 prepended the 'private access-modifier as soon as I completed the declaration.

Yeah, there are a lot of options for Resharper. But I like it because I don't have to think about formatting my code Poke tongue | ;-P


yours, Nicholas
GeneralRe: C# coding style question Pin
PIEBALDconsult5-Sep-13 3:39
mvePIEBALDconsult5-Sep-13 3:39 
AnswerRe: C# coding style question Pin
Rakesh Meel4-Sep-13 20:48
professionalRakesh Meel4-Sep-13 20:48 
AnswerRe: C# coding style question Pin
Ricardo Kajihara4-Sep-13 21:33
Ricardo Kajihara4-Sep-13 21:33 
AnswerRe: C# coding style question Pin
Christopher Kenis5-Sep-13 1:04
professionalChristopher Kenis5-Sep-13 1:04 
AnswerRe: C# coding style question Pin
Eytukan5-Sep-13 7:21
Eytukan5-Sep-13 7:21 
GeneralRe: C# coding style question Pin
BillWoodruff5-Sep-13 18:35
professionalBillWoodruff5-Sep-13 18:35 
GeneralRe: C# coding style question Pin
Eytukan5-Sep-13 19:02
Eytukan5-Sep-13 19:02 
AnswerRe: C# coding style question Pin
V.6-Sep-13 1:48
professionalV.6-Sep-13 1:48 
QuestionThread Progress Bar Pin
juliogyn4-Sep-13 8:31
juliogyn4-Sep-13 8:31 
AnswerRe: Thread Progress Bar Pin
Forbiddenx4-Sep-13 9:01
Forbiddenx4-Sep-13 9:01 
GeneralRe: Thread Progress Bar Pin
BillWoodruff4-Sep-13 17:23
professionalBillWoodruff4-Sep-13 17:23 
GeneralRe: Thread Progress Bar Pin
Forbiddenx6-Sep-13 1:16
Forbiddenx6-Sep-13 1:16 
AnswerRe: Thread Progress Bar Pin
Dave Kreskowiak4-Sep-13 9:03
mveDave Kreskowiak4-Sep-13 9:03 
AnswerRe: Thread Progress Bar Pin
V.6-Sep-13 1:51
professionalV.6-Sep-13 1:51 
QuestionAny Ideas or feedback for a C# final year programming project? Pin
johnmolo4-Sep-13 4:11
johnmolo4-Sep-13 4:11 
AnswerRe: Any Ideas or feedback for a C# final year programming project? Pin
Forbiddenx4-Sep-13 4:51
Forbiddenx4-Sep-13 4:51 
AnswerRe: Any Ideas or feedback for a C# final year programming project? Pin
Richard MacCutchan4-Sep-13 4:56
mveRichard MacCutchan4-Sep-13 4:56 

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.