<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.atalasoft.com/cs/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>Rick Minerich's Development Wonderland : C++</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B00_/default.aspx</link><description>Tags: C++</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How to determine which language(s) were used to build a .NET assembly</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx</link><pubDate>Thu, 26 Feb 2009 11:00:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:17547</guid><dc:creator>RickM</dc:creator><slash:comments>6</slash:comments><comments>http://www.atalasoft.com/cs/blogs/rickm/comments/17547.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/rickm/commentrss.aspx?PostID=17547</wfw:commentRss><wfw:comment>http://www.atalasoft.com/cs/blogs/rickm/rsscomments.aspx?PostID=17547</wfw:comment><description>&lt;p&gt;While in most cases there is no explicit information in an assembly as to which languages it was compiled from, it is possible to make an educated guess as to which languages were used.&amp;#160; This is due to the fact that each different .NET compiler leaves it’s own unique type of fingerprint.&amp;#160; In this article I discuss both my methodology for finding these fingerprints and which were unique to each language I used.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Methodology&lt;/h3&gt;  &lt;p&gt;For each language I made a new class library project.&amp;#160; I then reflected and compared each assembly to determine which unique characteristics it had.&amp;#160; It turned out that, at least for C#, F#, VB and C++, each was uniquely identifiable by the existence, or lack thereof, of certain features. &lt;/p&gt;  &lt;p&gt;So to break it down a bit.&lt;/p&gt;  &lt;p&gt;In each project I added one class and one public method in each of those classes:&lt;/p&gt;  &lt;pre style="border-right:#cecece 1px solid;padding-right:5px;border-top:#cecece 1px solid;padding-left:5px;min-height:40px;padding-bottom:5px;overflow:auto;border-left:#cecece 1px solid;width:480px;padding-top:5px;border-bottom:#cecece 1px solid;background-color:#fbfbfb;"&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  1: &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; CSharpClass
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  2: {
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  3:     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; LocalMethod() {}
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  4: }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;After compiling each of these projects into it’s own assembly, I referenced them from another testing project.&amp;#160; To grab a set of features for each language, I used the following three reflection calls:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.gettypes(VS.80).aspx"&gt;Assembly.GetTypes()&lt;/a&gt;

    &lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hk0t7cax(VS.80).aspx"&gt;Assembly.GetCustomAttirbutes()&lt;/a&gt;

    &lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hfkct7ct(VS.80).aspx"&gt;Module.GetFields( BindingFlags.NonPublic | BindingFlags.Static )&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then, with a simple program, I found which of these features were unique for each language.&amp;#160; This set of unique features ultimately represents a map of the imprint each compiler leaves.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;F#&lt;/h3&gt;

&lt;p&gt;A compiled F# library will only have one attribute by default:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This made it the easiest to differentiate of all the languages I tested.&amp;#160; Even more interesting, this attribute contains three fields which specify the specific version of the F# compiler used to generate the assembly:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Major&amp;#160;&amp;#160;&amp;#160; 1&amp;#160;&amp;#160;&amp;#160; int
    &lt;br /&gt;Minor&amp;#160;&amp;#160;&amp;#160; 9&amp;#160;&amp;#160;&amp;#160; int

    &lt;br /&gt;Release&amp;#160;&amp;#160;&amp;#160; 6&amp;#160;&amp;#160;&amp;#160; int &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I’m always impressed with how the F# team consistently goes above and beyond when it comes to the small details.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;Visual Basic&lt;/h3&gt;

&lt;p&gt;The Visual Basic assembly I generated was also easily identifiable via extra types which were automatically added:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;My.MyApplication
    &lt;br /&gt;My.MyComputer

    &lt;br /&gt;My.MyProject

    &lt;br /&gt;My.MyProject+MyWebServices

    &lt;br /&gt;My.MyProject+ThreadSafeObjectProvider`1

    &lt;br /&gt;My.Resources.Resource

    &lt;br /&gt;My.MySettings

    &lt;br /&gt;My.MySettingsProperty&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you can see from this list, the existence of these types in the “My” namespace is a fairly safe indicator that the Visual Basic language was used.&amp;#160; &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;C++ CLI / Managed C++&lt;/h3&gt;

&lt;p&gt;C++/CLI and Managed C++ are considered to be the same language with slightly different syntax as they share the same compiler.&amp;#160; However, there are four different compilation modes for C++ and each has somewhat different results.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;/CLR – Common Language Runtime Support&lt;/li&gt;

  &lt;li&gt;/CLR:pure – Pure Common Language Runtime Support&lt;/li&gt;

  &lt;li&gt;/CLR:safe – Safe Common Language Runtime Support&lt;/li&gt;

  &lt;li&gt;/CLR:OldSyntax – Managed C++ Syntax&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;/CLR&lt;/strong&gt;, &lt;strong&gt;/CLR:pure&lt;/strong&gt; and &lt;strong&gt;/CLR:OldSyntax&lt;/strong&gt; settings provide easy to classify assemblies, as they all inject an enormous number of types (70+) into the assembly.&amp;#160; I verified that contained two types from the vc_attributes namespace:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;vc_attributes.YesNoMaybe
    &lt;br /&gt;vc_attributes.AccessType&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However, &lt;strong&gt;/CLR:Safe&lt;/strong&gt; is much different in that it injects no types and adds no assembly attributes by default.&amp;#160; The generated assembly was almost completely clean.&amp;#160; I was forced to use Reflector to determine how to differentiate this from C#.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;C#&lt;/h3&gt;

&lt;p&gt;C# was one the most difficult to identify assembly type.&amp;#160; This is due to the fact that it has no unique types and only one unique attribute:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;System.Reflection.AssemblyConfigurationAttribute&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Unfortunately, this attribute is defined in the AssemblyInfo.cs file and so we can’t depend on it.&amp;#160; Up to this point it was only necessary to use two reflection calls:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.gettypes(VS.80).aspx"&gt;Assembly.GetTypes()&lt;/a&gt;

    &lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hk0t7cax(VS.80).aspx"&gt;Assembly.GetCustomAttirbutes()&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I was hoping to keep things very simple.&amp;#160; However, to differentance these two languages it’s necessary to go a bit further.&amp;#160; It turns out that C++ always injects an module level field into the assembly while C# does not.&amp;#160; And so by using:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hfkct7ct(VS.80).aspx"&gt;Module.GetFields(BindingFlags.NonPublic | BindingFlags.Static)&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We can check for the existence of this kind of field and so differentiate these two types.&amp;#160; &lt;/p&gt;

&lt;p&gt;After some investigation with reflector, I was able to find one particular feature unique to C#.&amp;#160; Unfortunately, it requires disassembling functions and looking at the resulting IL.&amp;#160; It seems as though a function definition&lt;strong&gt; never has a .maxstack of less than 8&lt;/strong&gt;.&amp;#160; In all other languages I observed .maxstack had been set to values as low as 0 when defined in an empty function.&amp;#160; &lt;/p&gt;

&lt;p&gt;However, as I am only currently concerned with these four languages, my testing on this matter has been very shallow and so pleae take it with a grain of salt.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;I admit that my sample Assembly set was very small and my feature set very large.&amp;#160; However, while this type of classification may not be robust enough to be applicable to a system which depended on these results being absolutely true, I’ve shown that it is in fact entirely possible to make reasonably confident guesses as to the language used to generate a .NET assembly while using only simple reflection.&amp;#160; It would be interesting to see how well this holds for obfuscated assemblies as well as other “bare minimum” compilations generated via different combinations of compiler settings.&lt;/p&gt;

&lt;p&gt;The next obvious step would be to extend what I have already written into a full &lt;a href="http://www.codeproject.com/KB/cs/BayesClassifier.aspx"&gt;Bayesian classifier&lt;/a&gt;.&amp;#160; Would be much better than a hardcoded hierarchy which would be fragile and possibly completely and repeatedly incorrect for some cases.&amp;#160; Another big advantage of using &lt;a href="http://hunch.net/?p=230"&gt;machine learning here&lt;/a&gt;, is that it would be easy to add new features and classification categories.&amp;#160; &lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx&amp;amp;;subject=How+to+determine+which+language(s)+were+used+to+build+a+.NET+assembly" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx&amp;amp;;title=How+to+determine+which+language(s)+were+used+to+build+a+.NET+assembly" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx&amp;amp;title=How+to+determine+which+language(s)+were+used+to+build+a+.NET+assembly" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx&amp;amp;;title=How+to+determine+which+language(s)+were+used+to+build+a+.NET+assembly" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx&amp;amp;;title=How+to+determine+which+language(s)+were+used+to+build+a+.NET+assembly&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/26/how-to-determine-which-language-s-were-used-to-build-a-net-assembly.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=17547" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/programming/default.aspx">programming</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/VB.NET/default.aspx">VB.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/reflection/default.aspx">reflection</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B002F00_CLI/default.aspx">C++/CLI</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/classification/default.aspx">classification</category></item><item><title>One of these languages is not like the others - Part 1 - Enforcement of Abstract Implementation</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx</link><pubDate>Tue, 10 Feb 2009 15:47:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:17443</guid><dc:creator>RickM</dc:creator><slash:comments>5</slash:comments><comments>http://www.atalasoft.com/cs/blogs/rickm/comments/17443.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/rickm/commentrss.aspx?PostID=17443</wfw:commentRss><wfw:comment>http://www.atalasoft.com/cs/blogs/rickm/rsscomments.aspx?PostID=17443</wfw:comment><description>&lt;p&gt;This is the first in a series of posts on the topic of interaction between different .NET languages.&amp;#160; I will cover all of the major Microsoft languages: C#, Visual Basic, F# and C++/CLI. &lt;/p&gt;  &lt;p&gt;In this first post in the series I will build a four language project in Visual Studio 2008 and begin to explore inter-language inheritance.&amp;#160; One of the languages behaves in a significantly different way when compared with the others, can you guess which one it is? &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Enforcement of Abstract Implementation&lt;/h3&gt;  &lt;p&gt;First things first, let’s define our abstract base class.&amp;#160; C# is considered the standard language for library architecting and so it is what we will be using.&lt;/p&gt;  &lt;pre style="border-right:#cecece 1px solid;padding-right:5px;border-top:#cecece 1px solid;padding-left:5px;min-height:40px;padding-bottom:5px;overflow:auto;border-left:#cecece 1px solid;width:480px;padding-top:5px;border-bottom:#cecece 1px solid;background-color:#fbfbfb;"&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  1: &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; abstract &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; CSharpBaseClass
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  2: {
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  3:   &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; abstract void PublicAbstractMethod();      
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  4:   &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; abstract void PublicAbstractMethod(int inint);
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  5:   &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; abstract void ProtectedAbstractMethod();
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  6:   &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; abstract void ProtectedAbstractMethod(int inint);
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  7: }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;In each of our child projects we will be inheriting from this class.&amp;#160; Let’s start with &lt;strong&gt;C#&lt;/strong&gt;. &lt;/p&gt;

&lt;pre style="border-right:#cecece 1px solid;padding-right:5px;border-top:#cecece 1px solid;padding-left:5px;min-height:40px;padding-bottom:5px;overflow:auto;border-left:#cecece 1px solid;width:480px;padding-top:5px;border-bottom:#cecece 1px solid;background-color:#fbfbfb;"&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  1: &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; CSharpChildClass : CSharpBaseClass
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  2: {
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  3: }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Now anyone with even a bit of experience in the C# language knows that this won’t compile.&amp;#160; For each of the abstract methods in the base class the inheriting class is expected to provide an implementation. &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;… error CS0534: 'CSharpChild.CSharpChildClass' does not implement inherited abstract member …&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;This is similarly true for &lt;strong&gt;Visual Basic&lt;/strong&gt;. 

  &lt;br /&gt;&lt;/p&gt;

&lt;pre style="border-right:#cecece 1px solid;padding-right:5px;border-top:#cecece 1px solid;padding-left:5px;min-height:40px;padding-bottom:5px;overflow:auto;border-left:#cecece 1px solid;width:480px;padding-top:5px;border-bottom:#cecece 1px solid;background-color:#fbfbfb;"&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  1: &lt;span style="color:#0000ff;"&gt;Public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Class&lt;/span&gt; VBChildClass
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  2:   &lt;span style="color:#0000ff;"&gt;Inherits&lt;/span&gt; CSharpBase.CSharpBaseClass
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  3: &lt;span style="color:#0000ff;"&gt;End&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Class&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;/pre&gt;

&lt;blockquote&gt;
  &lt;p&gt;… error BC30610: Class 'VBChildClass' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;F#&lt;/strong&gt; shares this behavior as well.&lt;/p&gt;

&lt;pre style="border-right:#cecece 1px solid;padding-right:5px;border-top:#cecece 1px solid;padding-left:5px;min-height:40px;padding-bottom:5px;overflow:auto;border-left:#cecece 1px solid;width:480px;padding-top:5px;border-bottom:#cecece 1px solid;background-color:#fbfbfb;"&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  1: &lt;span style="color:#0000ff;"&gt;type&lt;/span&gt; FSharpChildClass() =
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  2:   inherit CSharpBase.CSharpBaseClass()&lt;/pre&gt;&lt;/pre&gt;

&lt;blockquote&gt;
  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; … error FS0191: No implementation was given for 'CSharpBaseClass.PublicAbstractMethod() : unit'. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Kudos to the F# compiler designers for the verbose compile time errors. &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; error FS0054: This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[&amp;lt;AbstractClass&amp;gt;]' attribute to your type.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;However, &lt;strong&gt;C++/CLI&lt;/strong&gt; does not.&amp;#160; It’s perfectly acceptable to inherit from an abstract class and provide no implementation for it’s abstract members.&lt;/p&gt;

&lt;pre style="border-right:#cecece 1px solid;padding-right:5px;border-top:#cecece 1px solid;padding-left:5px;min-height:40px;padding-bottom:5px;overflow:auto;border-left:#cecece 1px solid;width:480px;padding-top:5px;border-bottom:#cecece 1px solid;background-color:#fbfbfb;"&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  1: &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; ref &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; CppChildClass : &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; CSharpBaseClass
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  2: {
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  3: };&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;While a warning is issued, it seems insufficient for what has just taken place: &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;… warning C4570: 'CppChild::CppChildClass' : is not explicitly declared as abstract but has abstract functions &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The result is that the class in question is defaulted to abstract.&amp;#160; If someone where to attempt to instantiate it downstream, it would cause a compiler error:&lt;/p&gt;

&lt;pre style="border-right:#cecece 1px solid;padding-right:5px;border-top:#cecece 1px solid;padding-left:5px;min-height:40px;padding-bottom:5px;overflow:auto;border-left:#cecece 1px solid;width:480px;padding-top:5px;border-bottom:#cecece 1px solid;background-color:#fbfbfb;"&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;"&gt;  1: CppChildClass cpp = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; CppChildClass();
&lt;/pre&gt;&lt;pre style="font-size:12px;margin:0em;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#ffffff;"&gt;  2: cpp.LocalMethod();&lt;/pre&gt;&lt;/pre&gt;

&lt;blockquote&gt;
  &lt;p&gt;error CS0144: Cannot create an instance of the abstract class or interface 'ManagedCppChild.ManagedCppChildClass' &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is bad because, if you were an API developer and so did not consume all of your objects, it would be possible to ship a version of your product with abstract suddenly toggled on for one or more of your classes.&amp;#160; All it would take would be for a developer to add a new inherited class or member to an existing abstract base class without writing a corresponding test for every abstract member or inheriting class. &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;So, what can we learn from this?&amp;#160; It seem that when using C++/CLI (or managed C++) it is not sufficient to depend on abstract classes to enforce that members are implemented.&amp;#160; Testing must also be strictly enforced.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx&amp;amp;;subject=One+of+these+languages+is+not+like+the+others+-+Part+1+-+Enforcement+of+Abstract+Implementation" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx&amp;amp;;title=One+of+these+languages+is+not+like+the+others+-+Part+1+-+Enforcement+of+Abstract+Implementation" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx&amp;amp;title=One+of+these+languages+is+not+like+the+others+-+Part+1+-+Enforcement+of+Abstract+Implementation" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx&amp;amp;;title=One+of+these+languages+is+not+like+the+others+-+Part+1+-+Enforcement+of+Abstract+Implementation" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx&amp;amp;;title=One+of+these+languages+is+not+like+the+others+-+Part+1+-+Enforcement+of+Abstract+Implementation&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2009/02/10/one-of-these-languages-is-not-like-the-others-part-1-enforcement-of-abstract-implementation.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=17443" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/VB.NET/default.aspx">VB.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/fsharp/default.aspx">fsharp</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/languages/default.aspx">languages</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B002F00_CLI/default.aspx">C++/CLI</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/inheritance/default.aspx">inheritance</category></item><item><title>Avoiding the Dangers of Ambiguously Defined Data-Types</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx</link><pubDate>Fri, 03 Oct 2008 15:10:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:15911</guid><dc:creator>RickM</dc:creator><slash:comments>11</slash:comments><comments>http://www.atalasoft.com/cs/blogs/rickm/comments/15911.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/rickm/commentrss.aspx?PostID=15911</wfw:commentRss><wfw:comment>http://www.atalasoft.com/cs/blogs/rickm/rsscomments.aspx?PostID=15911</wfw:comment><description>&lt;p&gt;When you are handed a string, integer, or any value type, can you know what it really represents?&amp;nbsp; Can you define the range of appropriate behaviors for that data?&amp;nbsp; Can you tell if it's formatted correctly?&amp;nbsp;&amp;nbsp; The problem is, in all of these cases, you can't.&amp;nbsp; You can't be sure of it's meaning, it's format or even how to treat it.&amp;nbsp; This is why ambiguous types break the &lt;a href="http://en.wikipedia.org/wiki/Object-oriented_programming"&gt;object-oriented programming paradigm&lt;/a&gt; and should be avoided whenever possible.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Forward&lt;/b&gt;&lt;b&gt;&lt;br&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;It's laughable to think that a Physical Engineer or Physicist would work without the aid of units. This is because, when you have undefined units, you can't verify that the thing you get at the end of a computation is defined in a consistent way. &amp;nbsp; &lt;/p&gt;&lt;p&gt;In computing, the counterpart to the Physical Engineer is the Software Engineer.&amp;nbsp; Why is the Software Engineer not held to the same type of design integrity?&amp;nbsp; The use of ambiguously defined variables is one of the largest sources of bugs in modern software development and yet we ignore it.&amp;nbsp; In fact, with many dynamically typed languages we are moving in the direction of more and more ambiguity.&lt;br&gt;&lt;/p&gt;&lt;p&gt;In C# and Java, strings and value types are defined only in terms of their lexical and
mathematical operations.&amp;nbsp; Except from the context in which they are used, they carry no additional information about the meaning of their
content.&amp;nbsp; In order to perform any non-trivial operation on that data, you have to make assumptions about it's meaning, which in turn leads to bugs.&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Is what you are writing really object oriented?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;This may seem like a silly question to ask in the modern programming era.&amp;nbsp; Almost everyone is using an object oriented language these days and its mostly taken for granted.&amp;nbsp; However, as any beginning programmer knows, it is very
easy to program in an object oriented programming language while
completely ignoring the underlying paradigm.&lt;/p&gt;&lt;p&gt;We don't use OO because it's an agreed standard for implementing a programming language, we use it to solve a specific set of problems.&amp;nbsp; These problems are directly related to the modeling of data and data manipulation.&amp;nbsp; Groups of data subtypes are classified into a larger object and operations on that data are defined in such a way as to model behavior in terms of that classification.&amp;nbsp; If the paradigm is ignored these issues become manifest as ambiguity and disorganization.&amp;nbsp; &lt;/p&gt;&lt;p&gt;It follow that using ambiguous data-types in a public API goes directly against not only the object oriented paradigm but also the broader goal of data classification and program integrity.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Why not pass strings and value types as arguments to public methods?&lt;br&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Using an ambiguously defined data type instead of a well defined object
means that the domain and formatting of that data is left open to
question.&amp;nbsp; It also means that if a user of that data formats it
inappropriately it may find it's way into an operation for another type of data and cause havoc. &lt;br&gt;&lt;/p&gt;&lt;p&gt;For a programmer that is familiar with object oriented programming it often comes down to a choice of encapsulation versus convenience.&amp;nbsp; I know as well as anyone that having to define an object to carry your data when you could just pass in a string and a couple of integers can feel tedious.&amp;nbsp; However, by taking the easy way out, you are setting things up to fail down the road.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Consider, is it possible that sometime in the future someone will be using the API you are defining?&amp;nbsp; Will the person looking at that code know the specific format you chose for that string?&amp;nbsp; What about the range of valid values for those integers?&amp;nbsp; What kinds of assumptions about that data will be made that you may have not considered?&amp;nbsp; If they mess up that format or get the range wrong, at what point will it become obvious?&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;p&gt;There are a lot of advantages to using objects instead:&amp;nbsp; An object which was designed to carry that same data could verify that it is well defined when it is constructed.&amp;nbsp; It can hand back that data formatted or manipulated in many different ways.&amp;nbsp; You can well defined questions which can be asked about that data which makes program control flow more obvious.&amp;nbsp; Best of all, the code for all of these things is centralized and up to the discretion of the designer of said object.&amp;nbsp; Using a well defined object, two people with different assumptions about that data but asking the same question will get the same result.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Of course, at the lowest level a CPU will be operating on basic value
types and so our code will always reflect that to some degree.&amp;nbsp;
However, because ambiguous types are extremely dangerous, they should
almost always be encapsulated and well defined.&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;What tools are available to me in .NET?&lt;br&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;If you are a .NET programmer the best thing you can do right now is to become familiar with the already existing classes available for making your strings more well defined such as &lt;a href="http://msdn.microsoft.com/en-us/library/system.uri%28VS.80%29.aspx"&gt;System.Uri&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/system.io.fileinfo%28VS.80%29.aspx"&gt;System.IO.FileInfo&lt;/a&gt;.&amp;nbsp; I've put up a &lt;a href="http://stackoverflow.com/questions/168732/what-are-some-string-encapsulation-classes-which-specify-both-meaning-and-behav"&gt;question on stackoverflow&lt;/a&gt; in order to try to build up a list of available container classes.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Beyond the use of predefined classes, it's best to make your own encapsulation objects with heavy up front validation.&amp;nbsp; You can then use extension methods to make native .NET classes take your new validated type.&amp;nbsp; It would be worth putting together a library of free encapsulation classes, structs and extension methods to allow for easy interoperability.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Beware, the .NET Framework encourages ambiguous types.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Unfortunately, as well designed as it is for many things, the .NET Framework is pretty bad about ambiguity.&amp;nbsp; Based on classes such as System.IO.Path and System.IO.FileStream which for some reason take paths represented as strings,&amp;nbsp; you might even say that ambiguity is encouraged.&amp;nbsp; Consider the vast number of methods in .NET classes which take unencapsulated strings and scalar types. &lt;br&gt;&lt;/p&gt;&lt;p&gt;The most unfortunate side effect of this design is that users of the .NET API may come to believe that this is the way things should be in a proper object oriented API.&amp;nbsp; Also, as a consequence, if you want your own product's API to be easily understood by a .NET user you have to follow the same destructive conventions.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;F# helps to solve this problem with Units of Measure.&lt;br&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;In most object oriented languages, if you were to encapsulate every single scalar value that was passed into a method, it would be quite a lot of extra coding.&amp;nbsp; Microsoft's newest programming language, F#, has a feature called &lt;a href="http://blogs.msdn.com/andrewkennedy/archive/2008/08/20/units-of-measure-in-f-part-one-introducing-units.aspx"&gt;Units of Measure&lt;/a&gt; which allows a programmer to optionally specify both meaning and behavior for classes of scalar types.&amp;nbsp; &lt;/p&gt;&lt;p&gt;A scalar with a unit of measure is a real type which is enforced by the compiler.&amp;nbsp; When an operation is performed the resulting type is that of the combined units used for the calculation, just as they would be in physics or engineering.&amp;nbsp; This is because F# is designed in part to be used by engineers and scientists.&amp;nbsp; As a side effect we as programmers get to reap the same benefit.&lt;br&gt;&lt;/p&gt;&lt;p&gt;This type of scalar type classification has long been missing from object oriented languages.&amp;nbsp; It's a huge step forward and I hope other programming languages move to adopt it quickly.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Addendum&lt;/b&gt;&lt;/p&gt;&lt;p&gt;@Mark and Jon:&lt;/p&gt;
&lt;p&gt;I think I may not have fully expressed what I meant by "handed a
string or integer". The context am talking about is post-compilation
when variable names no longer have real meaning. In this context
(discounting reflection on variable name) all you can tell about an
integer is where it is coming from and it's value. An executing program
does not have access to documentation.&lt;/p&gt;
&lt;p&gt;It's also important to consider reflective programming. It is generally agreed that reflective
programming is where the object oriented world is headed. However, when
you have a scalar value, you can tell very little about it through
reflection. While it is possible to retrieve the variable's name using reflection, actually
using the name of said variable to carry type information is a methodology which is extremely
prone to errors from mistyping. Errors which will not be caught at
compile time and which may lead your program to incorrect paths of
execution.&lt;/p&gt;&lt;p&gt;Also, I want to note that while a string is not a scalar value it does suffer from the same type of ambiguity. For this reason it, and other "base" types, should be handled similarly.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx&amp;amp;;subject=Avoiding+the+Dangers+of+Ambiguously+Defined+Data-Types" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx&amp;amp;;title=Avoiding+the+Dangers+of+Ambiguously+Defined+Data-Types" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx&amp;amp;title=Avoiding+the+Dangers+of+Ambiguously+Defined+Data-Types" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx&amp;amp;;title=Avoiding+the+Dangers+of+Ambiguously+Defined+Data-Types" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx&amp;amp;;title=Avoiding+the+Dangers+of+Ambiguously+Defined+Data-Types&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/03/avoiding-ambiguous-types-in-c.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=15911" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/programming/default.aspx">programming</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/meta/default.aspx">meta</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/object+oriented/default.aspx">object oriented</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/code/default.aspx">code</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/ideas/default.aspx">ideas</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/fsharp/default.aspx">fsharp</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/javascript/default.aspx">javascript</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/technology/default.aspx">technology</category></item><item><title>Changing Your Garbage Collector Settings on the Fly (.NET Memory Management: Part 5)</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx</link><pubDate>Wed, 20 Aug 2008 20:39:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:15313</guid><dc:creator>RickM</dc:creator><slash:comments>7</slash:comments><comments>http://www.atalasoft.com/cs/blogs/rickm/comments/15313.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/rickm/commentrss.aspx?PostID=15313</wfw:commentRss><wfw:comment>http://www.atalasoft.com/cs/blogs/rickm/rsscomments.aspx?PostID=15313</wfw:comment><description>&lt;p&gt;It has come to my attention via a recent &lt;a href="http://dotnet.dzone.com/news/low-latency-gc-net-35"&gt;DZone article&lt;/a&gt; that .NET 3.5 and 2.0 SP1 jointly included a new feature which lets you manipulate the way your garbage collector acts programmatically.&amp;nbsp; This can be done through changing the value of a new property of the System.Runtime.GCSettings class named LatencyMode. In this article I will walk you through this new property and the different effects of each of it's possible settings.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Other Articles in This Series&lt;br&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/04/03/net-memory-managment-part-1-basic-housekeeping.aspx"&gt;Part 1 – Basic Housekeeping&lt;/a&gt;&lt;br&gt;&lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/04/15/improving-performance-through-stack-allocation-net-memory-management-part-2.aspx"&gt;Part 2 – Improving Performance Through Stack Allocation&lt;/a&gt;&lt;br&gt;&lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/04/22/increasing-the-size-of-your-stack-net-memory-management-part-3.aspx"&gt;Part 3 – Increasing the Size of your Stack&lt;/a&gt;&lt;br&gt;&lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/05/14/choosing-the-right-garbage-collector-settings-for-your-application-net-memory-management-part-4.aspx"&gt;Part 4 – Choosing the Right Garbage Collector Settings&lt;/a&gt;&lt;br&gt;&lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx"&gt;Part 5 – Changing Your Garbage Collector Settings on the Fly&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;LatencyMode&lt;/b&gt; &lt;br&gt;&lt;/p&gt;&lt;p&gt;The new LatencyMode property accepts three different enumerated values.&amp;nbsp; The first two of which are Batch and Interactive which correspond to turning &amp;lt;gcConcurrent&amp;gt; on and off inside of your application configuration.&amp;nbsp; However, the effects of the third value, which is named LowLatency, were previously unavailable by any means.&amp;nbsp; By setting this the LatencyMode to LowLatency you can now put the Garbage Collector in an ultra-conservative mode which will insure the application will be interrupted as infrequently as possible.&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;p&gt;There are a couple of things you should take note of before changing your Garbage Collector's LatencyMode:&lt;br&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;LatencyMode settings are process-wide and so all of the threads in your application will be effected.&lt;/li&gt;&lt;li&gt;Changing LatencyMode will have no effect if your application has &amp;lt;gcServer&amp;gt; mode set in its configuration file.&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Now, let’s explore each of the possible values of LatencyMode in detail:&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Batch &lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;When it’s useful: &amp;nbsp;&lt;br&gt;It’s useful in applications without a UI and in Server Based Software.&amp;nbsp; It may also be useful to switch your garbage collector into Batch latency mode if your application has a data crunching mode which occurs after a user interface.&lt;br&gt;&lt;/p&gt;&lt;p&gt;What it does: &lt;br&gt;This is the most intrusive setting.&amp;nbsp; Garbage Collection is done non-concurrently in one big batch call. Your program will be suspended while garbage collection takes place.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Defaults:&lt;br&gt;This is the default value when &amp;lt;gcConcurrent&amp;gt; is disabled.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Notes:&lt;br&gt;Even though this will be the enumeration which will be set if &amp;lt;gcServer&amp;gt; is enabled, the garbage collector will act as described in my &lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/05/14/choosing-the-right-garbage-collector-settings-for-your-application-net-memory-management-part-4.aspx"&gt;previous article&lt;/a&gt;.&amp;nbsp; In fact, if you have your application defined to be in &amp;lt;gcServer&amp;gt; mode the LatencyMode property cannot be changed from its default of “Batch”.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Interactive&lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;When it’s useful:&lt;br&gt;It’s the best mode for most any UI-based application. &lt;br&gt;&lt;/p&gt;&lt;p&gt;What it does:&lt;br&gt;This is the most balanced setting.&amp;nbsp; Garbage Collection happens concurrently with your application.&amp;nbsp; Most of the work is done in a separate thread and although your application will be suspended it will not happen very often and for only very short periods of time. &lt;br&gt;&lt;/p&gt;&lt;p&gt;Defaults:&lt;br&gt;This is the default value for garbage collection on workstations.&amp;nbsp; If &amp;lt;gcConcurrent&amp;gt; is left at its default value, this is the type of garbage collection that will occur.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;LowLatency&lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;When it’s useful:&lt;br&gt;It’s useful for time sensitive applications such as 3d rendering or data acquisition.&lt;br&gt;&lt;/p&gt;&lt;p&gt;What it does:&lt;br&gt;This is the least intrusive mode the Garbage Collector can be set to.&amp;nbsp; As in Interactive, garbage collections happen concurrently with your application.&amp;nbsp; However, collection of older objects will only happen when memory pressure becomes high.&amp;nbsp; Collection of generation 2 objects is kept to a bare minimum.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Defaults:&lt;br&gt;This is never the default setting.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Notes:&lt;br&gt;LowLatency mode was designed for short time use only during time-critical sections of your application.&amp;nbsp; Leaving an application in LowLatency mode for an extended period of time will cause unused objects accumulate.&amp;nbsp; Before using low latency mode, you should take a look at the guidelines laid out at the bottom of the &lt;a href="http://msdn.microsoft.com/en-us/library/bb384202.aspx"&gt;MSDN Latency Modes page&lt;/a&gt;. &lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;References&lt;/b&gt;&lt;br&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb384202.aspx"&gt;MSDN Visual Studio 2008 Developer Center – Latency Modes&lt;/a&gt;&lt;br&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.runtime.gclatencymode.aspx"&gt;MSDN .NET Framework Developer Center – GCLatencyMode Enumeration&lt;/a&gt;&lt;br&gt;&lt;a href="http://dotnet.dzone.com/news/low-latency-gc-net-35"&gt;DZone - Low-Latency GC in .NET 3.5&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx&amp;amp;;subject=Changing+Your+Garbage+Collector+Settings+on+the+Fly+(.NET+Memory+Management%3a+Part+5)" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx&amp;amp;;title=Changing+Your+Garbage+Collector+Settings+on+the+Fly+(.NET+Memory+Management%3a+Part+5)" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx&amp;amp;title=Changing+Your+Garbage+Collector+Settings+on+the+Fly+(.NET+Memory+Management%3a+Part+5)" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx&amp;amp;;title=Changing+Your+Garbage+Collector+Settings+on+the+Fly+(.NET+Memory+Management%3a+Part+5)" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx&amp;amp;;title=Changing+Your+Garbage+Collector+Settings+on+the+Fly+(.NET+Memory+Management%3a+Part+5)&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=15313" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/code/default.aspx">code</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/optimization/default.aspx">optimization</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/VB.NET/default.aspx">VB.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/Tutorials/default.aspx">Tutorials</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/memory/default.aspx">memory</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/garbage+collection/default.aspx">garbage collection</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/gc/default.aspx">gc</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/fsharp/default.aspx">fsharp</category></item><item><title>A .NET Assembly for Cloning Objects with Arbitrary Field Value Changes: IcManipluator</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/2008/07/11/a-net-assembly-for-cloning-objects-with-arbitrary-field-values-changes-icmanipluator.aspx</link><pubDate>Fri, 11 Jul 2008 18:45:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14891</guid><dc:creator>RickM</dc:creator><slash:comments>3</slash:comments><comments>http://www.atalasoft.com/cs/blogs/rickm/comments/14891.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/rickm/commentrss.aspx?PostID=14891</wfw:commentRss><wfw:comment>http://www.atalasoft.com/cs/blogs/rickm/rsscomments.aspx?PostID=14891</wfw:comment><description>After my last post, A Safe and Asynchronous One to Many Stream Copy Through IL and Inheritance ”, I ordered a few books and spent some time playing with generating IL. Along the way I’ve developed a library which allows you to make a franken-clone of...(&lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/07/11/a-net-assembly-for-cloning-objects-with-arbitrary-field-values-changes-icmanipluator.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14891" width="1" height="1"&gt;</description><enclosure url="http://www.atalasoft.com/cs/blogs/rickm/attachment/14891.ashx" length="96867" type="application/x-zip-compressed" /><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/programming/default.aspx">programming</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/code/default.aspx">code</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/IL/default.aspx">IL</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/MSIL/default.aspx">MSIL</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/memory/default.aspx">memory</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/stack/default.aspx">stack</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/allocation/default.aspx">allocation</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/unsafe/default.aspx">unsafe</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/reflection/default.aspx">reflection</category></item><item><title>Choosing the Right Garbage Collector Settings for Your Application (.NET Memory Management: Part 4)</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/2008/05/14/choosing-the-right-garbage-collector-settings-for-your-application-net-memory-management-part-4.aspx</link><pubDate>Wed, 14 May 2008 18:11:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14040</guid><dc:creator>RickM</dc:creator><slash:comments>5</slash:comments><comments>http://www.atalasoft.com/cs/blogs/rickm/comments/14040.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/rickm/commentrss.aspx?PostID=14040</wfw:commentRss><wfw:comment>http://www.atalasoft.com/cs/blogs/rickm/rsscomments.aspx?PostID=14040</wfw:comment><description>Tuning the garbage collector to the specific context of the particular application can significantly improve the performance of both non-threaded and multi-threaded applications. In this post I discuss the gcConcurrent and gcServer settings which allow...(&lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/05/14/choosing-the-right-garbage-collector-settings-for-your-application-net-memory-management-part-4.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14040" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/code/default.aspx">code</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/optimization/default.aspx">optimization</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/VB.NET/default.aspx">VB.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/Tutorials/default.aspx">Tutorials</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/memory/default.aspx">memory</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/garbage+collection/default.aspx">garbage collection</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/gc/default.aspx">gc</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/fsharp/default.aspx">fsharp</category></item><item><title>Basic Memory Housekeeping (.NET Memory Management: Part 1)</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/2008/04/03/net-memory-managment-part-1-basic-housekeeping.aspx</link><pubDate>Thu, 03 Apr 2008 21:25:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13602</guid><dc:creator>RickM</dc:creator><slash:comments>7</slash:comments><comments>http://www.atalasoft.com/cs/blogs/rickm/comments/13602.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/rickm/commentrss.aspx?PostID=13602</wfw:commentRss><wfw:comment>http://www.atalasoft.com/cs/blogs/rickm/rsscomments.aspx?PostID=13602</wfw:comment><description>This is the first in a series of posts I will be writing about managing memory in .NET. Before I move on to more complex techniques, I thought it would be good to cover the basics. Articles in This Series Part 1 - Basic Housekeeping Part 2 - Improving...(&lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/04/03/net-memory-managment-part-1-basic-housekeeping.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13602" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/VB.NET/default.aspx">VB.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/Tutorials/default.aspx">Tutorials</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/memory/default.aspx">memory</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/struct/default.aspx">struct</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/structs/default.aspx">structs</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/IDisposable/default.aspx">IDisposable</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/garbage+collection/default.aspx">garbage collection</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/gc/default.aspx">gc</category></item><item><title>Counting Processors in .NET: The Pros and Cons of Five Different Methods</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/2008/04/01/counting-processors-in-net-the-pros-and-cons-of-five-different-methods.aspx</link><pubDate>Tue, 01 Apr 2008 18:54:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13585</guid><dc:creator>RickM</dc:creator><slash:comments>4</slash:comments><comments>http://www.atalasoft.com/cs/blogs/rickm/comments/13585.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/rickm/commentrss.aspx?PostID=13585</wfw:commentRss><wfw:comment>http://www.atalasoft.com/cs/blogs/rickm/rsscomments.aspx?PostID=13585</wfw:comment><description>There are a great number of different ways to count the number of processors available to the .NET developer. In this post I will go over some of the more common methods and their pros and cons. The Envirionment.ProcessorCount Way Code: Environment .ProcessorCount;...(&lt;a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/04/01/counting-processors-in-net-the-pros-and-cons-of-five-different-methods.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13585" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/programming/default.aspx">programming</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/code/default.aspx">code</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/Processors/default.aspx">Processors</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/VB.NET/default.aspx">VB.NET</category></item></channel></rss>