If I write (or use) a generic class, e.g. List, and parameterize it with two different enumerated types, will I get two copies of code JITted? Given the following articles that discuss the how the JITter generates one copy for reference types, and one copy for each value type, I think this boils down to, "Is each specific enum considered a different value type for the purpose of JITting?"
http://msdn.microsoft.com/en-us/library/ms379564%28v=vs.80%29.aspx#csharp_generics_topic1
In C# code:
using System.Collections.Generic;
namespace Z
{
class Program
{
enum A {a}
enum B {b}
class C<T>
{
}
static void Main(string[] args)
{
var x = new C<A>();
var y = new C<B>(); // does this JIT a new C constructor for enum type B?
}
}
}
I'm interested to know this in general, but also specifically for the .NET CF 3.5 (WindowsCE) JIT compiler (EDIT: because I'm interested in possible code bloat implications). Any suggestions on the best way to find this out? I was thinking of writing a function in class C that P/Invokes to native code, where I can break into the debugger and examine the callstack - specifically the return address, but perhaps someone can answer authoritatively based on the language rules of which I'm not aware...