// Consider initializing the field directly instead of declaring a .cctor.  There is a perf
        // tradeoff to either choice.  The tradeoff is some startup perf if you compile code
        // that references this type, vs. a bit of a hit every time you use one of these methods
        // because we must verify that the .cctor ran.  For now, we'll make this class slower
        // to use, but you can write code with quirks in it that only triggers iff you need legacy
        // behavior (ie, if you need to not throw an exception, see if you need to throw it first
        // via normal logic then check the compatibility flag).

        // Initialize the s_map field right before it's going to be used, not the moment we 
        // JITs code that contains a call to this class.  For this reason, explicitly create a
        // .cctor instead of letting the compiler generate one with different initialization
        // semantics.
        static BinaryCompatibility()
        {
            s_map = new BinaryCompatibilityMap();
        }
Exemplo n.º 2
0
        // Consider initializing the field directly instead of declaring a .cctor.  There is a perf
        // tradeoff to either choice.  The tradeoff is some startup perf if you compile code
        // that references this type, vs. a bit of a hit every time you use one of these methods
        // because we must verify that the .cctor ran.  For now, we'll make this class slower
        // to use, but you can write code with quirks in it that only triggers iff you need legacy
        // behavior (ie, if you need to not throw an exception, see if you need to throw it first
        // via normal logic then check the compatibility flag).

        // Initialize the s_map field right before it's going to be used, not the moment we
        // JITs code that contains a call to this class.  For this reason, explicitly create a
        // .cctor instead of letting the compiler generate one with different initialization
        // semantics.
        static BinaryCompatibility()
        {
            s_map = new BinaryCompatibilityMap();
        }