C Sharp: Difference between revisions
Brian Wilson (talk | contribs) |
Brian Wilson (talk | contribs) mNo edit summary |
||
Line 5: | Line 5: | ||
http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices | http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices | ||
== Frameworks == | |||
What is your favorite .net framework? | |||
Is it MEF? [http://msdn.microsoft.com/en-us/library/dd460648.aspx?ppud=4 Managed Extensibility Framework] | |||
Is it the Entity Framework? So many options. | |||
== readonly == | == readonly == |
Revision as of 00:17, 25 May 2012
I wanted this page to be called C# but apparently mediawiki did not approve. Oh well. Maybe I will put all things beginning with the letter 'c' here.
best practices
http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices
Frameworks
What is your favorite .net framework?
Is it MEF? Managed Extensibility Framework
Is it the Entity Framework? So many options.
readonly
Yes, there is a readonly setting for variables. One would think 'const' would be enough. Aren't these the same?
public static readonly string foo = "I am read - only."; // happens at program load public const string foo = "I am read - only"; // happens at compile time
Check the debugger, you can see before the first line executes that foo = null. Since it happens at load time, you can do this
public static readonly string foo = Something.StringThing();
so the value is set once, and it's done atomically so it is thread-safe.
Preprocessor Directives
#if DEBUG http://codeidol.com/csharp/essential-csharp/Operators-and-Control-Flow/Csharp-Preprocessor-Directives/ #endif
What about things in square brackets
That I can't type in a wiki, like "bracket CommandLine bracket"
When would I ever use a Struct?
Read the official documentation here.