SerializationTrace.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Serialization / System / Runtime / Serialization / SerializationTrace.cs / 1 / SerializationTrace.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
using System;
using System.Collections.Generic; 
using System.Diagnostics;
using System.Globalization; 
using System.Reflection; 
using System.Text;
using System.Threading; 
using System.Xml;
using System.Security;

namespace System.Runtime.Serialization 
{
 
    #if USE_REFEMIT 
    public static class SerializationTrace
    #else 
    static class SerializationTrace
    #endif
    {
        ///  
        /// Critical - Static fields are marked SecurityCritical or readonly to prevent
        ///            data from being modified or leaked to other components in appdomain. 
        ///  
        [SecurityCritical]
        static TraceSource codeGen; 

        internal static SourceSwitch CodeGenerationSwitch
        {
            get 
            {
                return CodeGenerationTraceSource.Switch; 
            } 
        }
 
        internal static void WriteInstruction(int lineNumber, string instruction)
        {
            CodeGenerationTraceSource.TraceInformation("{0:00000}: {1}", lineNumber, instruction);
        } 

        #if USE_REFEMIT 
        public static void TraceInstruction(string instruction) 
        #else
        internal static void TraceInstruction(string instruction) 
        #endif
        {
            CodeGenerationTraceSource.TraceEvent(TraceEventType.Verbose, 0, instruction);
        } 

        static TraceSource CodeGenerationTraceSource 
        { 
            /// 
            /// Critical - fetches the critical codeGen field 
            /// Safe - get-only properties only needs to be protected for write; initialized in getter if null.
            /// 
            [SecurityCritical, SecurityTreatAsSafe]
            get 
            {
                if (codeGen == null) 
                    codeGen = new TraceSource("System.Runtime.Serialization.CodeGeneration"); 
                return codeGen;
            } 
        }
    }

} 

 

// 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