<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BeaverBlog &#187; xml comments</title>
	<atom:link href="http://blog.crazybeavers.se/index.php/archive/tag/xml-comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.crazybeavers.se</link>
	<description>A beaver bloging about webdevelopment, XML and .Net</description>
	<lastBuildDate>Tue, 26 Jul 2011 10:59:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Disabling &#8220;Missing XML comment for publicly visible type or member XX&#8221;</title>
		<link>http://blog.crazybeavers.se/index.php/archive/disabling-missing-xml-comment-for-publicly-visible-type-or-member-xx/</link>
		<comments>http://blog.crazybeavers.se/index.php/archive/disabling-missing-xml-comment-for-publicly-visible-type-or-member-xx/#comments</comments>
		<pubDate>Sun, 24 May 2009 09:52:04 +0000</pubDate>
		<dc:creator>Karl</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Code samples]]></category>
		<category><![CDATA[pragma]]></category>
		<category><![CDATA[xml comments]]></category>

		<guid isPermaLink="false">http://blog.crazybeavers.se/?p=55</guid>
		<description><![CDATA[Adding descriptive comments to your code is something that everyone will always tell you to do though in reality many people simply don&#8217;t do it. Some are just lazy, some doesn&#8217;t see the need of it, some are to stressed out to do it and some things that the c# compiler will warn you about [...]]]></description>
			<content:encoded><![CDATA[<p>
  Adding descriptive comments to your code is something that everyone will always tell you to do though in reality many people simply don&#8217;t do it. Some are just lazy, some doesn&#8217;t see the need of it, some are to stressed out to do it and some things that the c# compiler will warn you about just doesn&#8217;t need commenting. Looking at the last category, things that just doesn&#8217;t need commenting, we many times find enums. Look at this as a sample.
</p>
<pre class="brush: csharp; title: ;">
/// &lt;summary&gt;
///  Datatypes used by the EXIF specification
/// &lt;/summary&gt;
public enum ExifDataTypes
{
	UnsignedByte = 1,
	AsciiString = 2,
	UnsignedShort = 3,
	UnsignedLong = 4,
	UnsignedRational = 5,
	SignedByte = 6,
	Undefined = 7,
	SignedShort = 8,
	SignedLong = 9,
	SignedRational = 10,
	SingleFloat = 11,
	DoubleFloat = 12
}
</pre>
<p>What useful comments could added to this? When compiling I&#8217;m getting twelve warnings about this code not being documented though I do have a hard time finding out what I should write about each option since I feel that the names are quite self explanatory. Just adding a dummy comment to each line would get rid of the warnings but also clutter up my code which isn&#8217;t really helping me. I could also tell the compiler to ignore all warnings of this type (&#8220;/nowarn 1591&#8243; when compiling) though there might be other places in my code where I want to know that I missed a comment.</p>
<p>So no luck just yet. There is however a third method to use. Going back to C there has been a way to communicate with the compiler from your code using directives called &#8220;pragmas&#8221;. C# have it as well though the standard compiler (csc.exe) only understands two commands, <a href="http://msdn.microsoft.com/en-us/library/441722ys(VS.80).aspx" target="_blank" title="Check it out on MSDN">warning</a> and <a href="http://msdn.microsoft.com/en-us/library/ms173226(VS.80).aspx" target="_blank"  title="Check it out on MSDN">checksum</a>. For my problem, warning was the one I could use.</p>
<p>The code below has a pragma added that tells the compiler not to raise warnings with id 1591 (missing comments) from line 6 to line 19.</p>
<pre class="brush: csharp; title: ;">
/// &lt;summary&gt;
///  Datatypes used by the EXIF specification
/// &lt;/summary&gt;
public enum ExifDataTypes
{
#pragma warning disable 1591
	UnsignedByte = 1,
	AsciiString = 2,
	UnsignedShort = 3,
	UnsignedLong = 4,
	UnsignedRational = 5,
	SignedByte = 6,
	Undefined = 7,
	SignedShort = 8,
	SignedLong = 9,
	SignedRational = 10,
	SingleFloat = 11,
	DoubleFloat = 12
#pragma warning restore 1591
}
</pre>
<p>It still gives me lots of warnings (still have some huge enums for the EXIF class that needs this) but now I have a chance of finding the real warnings and still document the parts of my code that really needs documenting.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crazybeavers.se/index.php/archive/disabling-missing-xml-comment-for-publicly-visible-type-or-member-xx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

