<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>C# Coding Standards by Lance's</title><link>http://weblogs.asp.net/brijmohan/archive/2008/10/10/c-coding-standards-by-lance-s.aspx</link><description>Following the right Coding standars comes with Practice and proper Guidance if you are a starter, and also lots of companies define or customize their own coding standards. When I came across this challange to define the coding standard for my team, I</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: C# Coding Standards by Lance's</title><link>http://weblogs.asp.net/brijmohan/archive/2008/10/10/c-coding-standards-by-lance-s.aspx#6790467</link><pubDate>Tue, 16 Dec 2008 14:21:26 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6790467</guid><dc:creator>Robert</dc:creator><author>Robert</author><description>&lt;p&gt;In our coding experience, we found it incredibly useful and important to be able to instantly distinguish between a class level field and a local function level variable. &amp;nbsp;using the same naming guidelines for both (ie, camel casing) can be confusing. &amp;nbsp;Prepending the _ onto the field level variable instantly identifies it as a such.&lt;/p&gt;
&lt;p&gt;Rob&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6790467" width="1" height="1"&gt;</description></item><item><title>Interesting Finds: 2008.10.12</title><link>http://weblogs.asp.net/brijmohan/archive/2008/10/10/c-coding-standards-by-lance-s.aspx#6673905</link><pubDate>Sun, 12 Oct 2008 02:24:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6673905</guid><dc:creator>gOODiDEA</dc:creator><author>gOODiDEA</author><description>&lt;p&gt;.NET ASP.NETMVCandthenewIIS7RewriteModule&lt;/p&gt;
&lt;p&gt;My10commonmistakesinASP.NET&lt;/p&gt;
&lt;p&gt;C#CodingS...&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6673905" width="1" height="1"&gt;</description></item><item><title>re: C# Coding Standards by Lance's</title><link>http://weblogs.asp.net/brijmohan/archive/2008/10/10/c-coding-standards-by-lance-s.aspx#6669285</link><pubDate>Fri, 10 Oct 2008 15:29:56 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6669285</guid><dc:creator>JV</dc:creator><author>JV</author><description>&lt;p&gt;@mohanbrij: I understand the reasoning why to use prefixes, but my most important argument is that you can also easily see that something is a private variable without the underscore (Even without using intellisense and syntax highlighting). The same arguments for enums,classes etc fit for those private variables. Even in notepad it&amp;#39;s easily distinquisable when you use the approriate casing (Which is also defined in the document).&lt;/p&gt;
&lt;p&gt;But I do think it&amp;#39;s a minor thing (I don&amp;#39;t even wanna call it an issue/problem). It&amp;#39;s a good document :). It&amp;#39;s just something I see in lots of guidelines, but whenever I confront the author with it, it always ends up in: &amp;quot;I prefer/like to do this this way&amp;quot; (Nothing wrong with that) or legacy reasons. So I&amp;#39;m always intrested in the thoughts behind it :)&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6669285" width="1" height="1"&gt;</description></item><item><title>re: C# Coding Standards by Lance's</title><link>http://weblogs.asp.net/brijmohan/archive/2008/10/10/c-coding-standards-by-lance-s.aspx#6668940</link><pubDate>Fri, 10 Oct 2008 13:02:35 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6668940</guid><dc:creator>AndrewSeven</dc:creator><author>AndrewSeven</author><description>&lt;p&gt;That seems to have improved since that last time I looked at it, but all the same, I would suggest using the &amp;quot;Framework Design Guidelines&amp;quot; as the starting point for &amp;nbsp;any coding guideline.&lt;/p&gt;
&lt;p&gt;If you want to be strict, you can use Style Cop, but it has several rules like spaces vs. tabs that some of us don&amp;#39;t like.&lt;/p&gt;
&lt;p&gt;From the Framework Design Guidelines:&lt;/p&gt;
&lt;p&gt;&amp;quot;DO name Generic parameters with descriptive names, unless a single-letter name is completely self-explanatory and a descriptive name would not add value&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;quot;Consider using T as the type parameter name for types with ONE single-letter type parameter&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;quot;Do prefix type parameter names with T&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;quot;Consider indicating constraints placed on a type parameter in the name of the parameter&amp;quot;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6668940" width="1" height="1"&gt;</description></item><item><title>re: C# Coding Standards by Lance's</title><link>http://weblogs.asp.net/brijmohan/archive/2008/10/10/c-coding-standards-by-lance-s.aspx#6668810</link><pubDate>Fri, 10 Oct 2008 12:16:18 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6668810</guid><dc:creator>mohanbrij</dc:creator><author>mohanbrij</author><description>&lt;p&gt;Hi JV,&lt;/p&gt;
&lt;p&gt;In Line 2.1.16, When he said avoid adding redundant or meaningless prefixes or suffixes, it means when we are defining enums, we already know this is enum, so it looks redundant when we name something like ColorEnum, similarly for Struct, Class, etc.&lt;/p&gt;
&lt;p&gt;Also in Section 1.4.1 and 2.2, accordint to microsoft coding standards its good practice to prefix the private variable (field, constant, static fields) with _underscores, similarly in section 2.2 please see he is using only the private variables with _usderscores.&lt;/p&gt;
&lt;p&gt;What I found good in this document is it covers almost everything, section 5 also explains the important Object Model and Design API in very few words. Which is all we need very often.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6668810" width="1" height="1"&gt;</description></item><item><title>re: C# Coding Standards by Lance's</title><link>http://weblogs.asp.net/brijmohan/archive/2008/10/10/c-coding-standards-by-lance-s.aspx#6668700</link><pubDate>Fri, 10 Oct 2008 11:43:43 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6668700</guid><dc:creator>JV</dc:creator><author>JV</author><description>&lt;p&gt;Nice guidelines indeed, however it does contain some contradictions. Eg 2.1.16 says &amp;quot;Do not use public enum ColorEnum&amp;quot; (avoid redundant or meaningless prefixes and suffixes), but in 1.4.1 and 2.2 he does use redundant/meaningless prefixes (the &amp;quot;_&amp;quot;) several times. Those are not necesary at all in C# and the goal when you use them is the same as using suffixes for ColorEnum.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6668700" width="1" height="1"&gt;</description></item></channel></rss>