Internal.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Internal.cs / 3 / Internal.cs

                            // ==++== 
//
//   Copyright (c) Microsoft Corporation.  All rights reserved.
//
// ==--== 
/*============================================================
** 
** This file exists to contain miscellaneous module-level attributes 
** and other miscellaneous stuff.
** 
**
**
===========================================================*/
using System.Runtime.InteropServices; 
using System.Runtime.CompilerServices;
using System.Collections.Generic; 
using System.Reflection; 

#if FEATURE_COMINTEROP 

[assembly:Guid("BED7F4EA-1A96-11d2-8F08-00A0C9A6186D")]

// The following attribute are required to ensure COM compatibility. 
[assembly:System.Runtime.InteropServices.ComCompatibleVersion(1, 0, 3300, 0)]
[assembly:System.Runtime.InteropServices.TypeLibVersion(2, 0)] 
 
#endif // FEATURE_COMINTEROP
 
[assembly:DefaultDependencyAttribute(LoadHint.Always)]
// mscorlib would like to have its literal strings frozen if possible
[assembly: System.Runtime.CompilerServices.StringFreezingAttribute()]
 
namespace System
{ 
    static class Internal 
    {
        // This method is purely an aid for NGen to statically deduce which 
        // instantiations to save in the ngen image.
        // Otherwise, the JIT-compiler gets used, which is bad for working-set.
        // Note that IBC can provide this information too.
        // However, this helps in keeping the JIT-compiler out even for 
        // test scenarios which do not use IBC.
        // This can be removed after V2, when we implement other schemes 
        // of keeping the JIT-compiler out for generic instantiations. 

        static void CommonlyUsedGenericInstantiations_HACK() 
        {
            // Make absolutely sure we include some of the most common
            // instantiations here in mscorlib's ngen image.
            // Note that reference type instantiations are already included 
            // automatically for us.
 
            System.Array.Sort(null); 
            System.Array.Sort(null);
            System.Array.Sort(null); 

            new ArraySegment(new byte[1], 0, 0);

            new Dictionary(); 
            new Dictionary();
            new Dictionary(); 
            new Dictionary(); 
            new Dictionary();
            new Dictionary(); 
            new Dictionary();
            new Dictionary();
            new Dictionary();
            new Dictionary(); 
            new Dictionary();
            new Dictionary(); 
            new Dictionary(); 
            new Dictionary();
            new Dictionary(); 

            NullableHelper_HACK();
            NullableHelper_HACK();
            NullableHelper_HACK(); 
            NullableHelper_HACK();
            NullableHelper_HACK(); 
            NullableHelper_HACK(); 
            NullableHelper_HACK();
            NullableHelper_HACK(); 
            NullableHelper_HACK();
            NullableHelper_HACK();
            NullableHelper_HACK();
            NullableHelper_HACK(); 

            new List(); 
            new List(); 
            new List();
            new List(); 
            new List();
            new List();
            new List();
            new List(); 
            new List();
            new List(); 
            new List(); 
            new List();
            new List(); 
            new List();
            new List();
            new List>();
 
            RuntimeType.RuntimeTypeCache.Prejitinit_HACK();
 
            new CerArrayList(0); 
            new CerArrayList(0);
            new CerArrayList(0); 
            new CerArrayList(0);
            new CerArrayList(0);
            new CerArrayList(0);
 
            new KeyValuePair('\0', UInt16.MinValue);
            new KeyValuePair(UInt16.MinValue, Double.MinValue); 
 

            SZArrayHelper_HACK(null); 
            SZArrayHelper_HACK(null);
            SZArrayHelper_HACK(null);
            SZArrayHelper_HACK(null);
            SZArrayHelper_HACK(null); 
            SZArrayHelper_HACK(null);
            SZArrayHelper_HACK(null); 
            SZArrayHelper_HACK(null); 
            SZArrayHelper_HACK(null);
            SZArrayHelper_HACK(null); 
            SZArrayHelper_HACK(null);
            SZArrayHelper_HACK(null);
            SZArrayHelper_HACK(null);
            SZArrayHelper_HACK(null); 
            SZArrayHelper_HACK(null);
 
            SZArrayHelper_HACK(null); 
            SZArrayHelper_HACK(null);
        } 

        static T NullableHelper_HACK() where T : struct
        {
            Nullable.Compare(null, null); 
            Nullable.Equals(null, null);
            Nullable nullable = new Nullable(); 
            return nullable.GetValueOrDefault(); 
        }
 
        static void SZArrayHelper_HACK(SZArrayHelper oSZArrayHelper)
        {
            // Instantiate common methods for IList implementation on Array
            oSZArrayHelper.get_Count(); 
            oSZArrayHelper.get_Item(0);
            oSZArrayHelper.GetEnumerator(); 
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK