<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://community.submain.com/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>CodeIt.Right</title><link>http://community.submain.com/forums/4/ShowForum.aspx</link><description>If you are having a problem using &lt;A href="http://submain.com/codeit.right"&gt;&lt;B&gt;CodeIt.Right&lt;/B&gt;&lt;/A&gt;, post a message here.</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.2)</generator><item><title>Re: Suggestion to make "Do not declare externally visible instance fields " auto fix much nicer.</title><link>http://community.submain.com/forums/thread/660.aspx</link><pubDate>Thu, 04 Dec 2008 06:55:32 GMT</pubDate><guid isPermaLink="false">e6092f25-edd1-48d7-b80f-8bdb13d630d6:660</guid><dc:creator>Serge B.</dc:creator><slash:comments>0</slash:comments><comments>http://community.submain.com/forums/thread/660.aspx</comments><wfw:commentRss>http://community.submain.com/forums/commentrss.aspx?SectionID=4&amp;PostID=660</wfw:commentRss><description>Great suggestion. Thank you. We will add another correction option to replace it with a default. (When CodeIt.Right runs in VS2008 or newer)</description></item><item><title>Suggestion to make "Do not declare externally visible instance fields " auto fix much nicer.</title><link>http://community.submain.com/forums/thread/649.aspx</link><pubDate>Mon, 01 Dec 2008 14:10:50 GMT</pubDate><guid isPermaLink="false">e6092f25-edd1-48d7-b80f-8bdb13d630d6:649</guid><dc:creator>Chris Marlow</dc:creator><slash:comments>0</slash:comments><comments>http://community.submain.com/forums/thread/649.aspx</comments><wfw:commentRss>http://community.submain.com/forums/commentrss.aspx?SectionID=4&amp;PostID=649</wfw:commentRss><description>&lt;p&gt;When you fix the following rule:&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;table cellpadding="0" cellspacing="0" id="Table1"&gt;&lt;tr&gt;&lt;td&gt;&lt;div id="content"&gt;&lt;table id="Table2"&gt;&lt;tr&gt;&lt;td class="PageFrame"&gt;&lt;h3&gt;Do not declare externally visible instance fields&lt;/h3&gt;&lt;div class="PageContent"&gt;&lt;h4 class="dtH4"&gt;Violation Description&lt;/h4&gt;&lt;p&gt;Externally visible type &lt;span class="code-fragment"&gt;&lt;font color="#a52a2a"&gt;BuildLab.SharedFunctionality.Utility.ActiveDirectoryWrapper&lt;/font&gt;&lt;/span&gt; contains an instance field &lt;span class="code-fragment"&gt;&lt;font color="#a52a2a"&gt;userData&lt;/font&gt;&lt;/span&gt; is externally visible because has &lt;strong&gt;public&lt;/strong&gt; modifier. &lt;/p&gt;&lt;h4 class="dtH4"&gt;Correcting Violation&lt;/h4&gt;&lt;p&gt;The rule provides the following auto-correct options: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;Change field modifier to &lt;strong&gt;private&lt;/strong&gt;. &lt;/li&gt;&lt;li&gt;Create property from the field and set its modifier to &lt;strong&gt;public&lt;/strong&gt;. &lt;/li&gt;&lt;li&gt;Create property from the field with name and modifier specified. &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;you currently rename the public property to be userData1 by default.&amp;nbsp; I personally can&amp;#39;t stand numbers being tagged on to things, but that is a minor problem&amp;nbsp; If the field was used globally, there is a very good chance that the name is what they want it to be referred to.&amp;nbsp; It would make much more sense to me to simply rename the filed to a different name and keep the property as the same name.&amp;nbsp; Then your code won&amp;#39;t get littered with old field names with 1 tagged at the end.&amp;nbsp; Now the private field is being renamed, it can have a more sensible name like UserDataInternal, or MyUserData, or anything that is more descriptive than UserData1!&lt;/p&gt;&lt;p&gt;So in this example:&lt;/p&gt;&lt;p&gt;public string userData1;&lt;/p&gt;&lt;p&gt;becomes:&lt;/p&gt;&lt;p&gt;private string userDataInternal;&lt;br /&gt;public string&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return userDataInternal; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set {&amp;nbsp;userDataInternal&amp;nbsp;= value; }&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;The options page should allow you to override both the public and the private default names, but ideally you need a useable default.&lt;/p&gt;&lt;p&gt;Thanks,&lt;br /&gt;Chris.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/p&gt;</description></item></channel></rss>