SerializationTrace.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Serialization / System / Runtime / Serialization / SerializationTrace.cs / 1305376 / SerializationTrace.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Runtime.Serialization
{ 
    using System.Diagnostics;
    using System.Security; 
 
    #if USE_REFEMIT
    public static class SerializationTrace 
    #else
    static class SerializationTrace
    #endif
    { 
        [Fx.Tag.SecurityNote(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
        { 
            [Fx.Tag.SecurityNote(Critical = "Fetches the critical codeGen field.", 
                Safe = "Get-only properties only needs to be protected for write; initialized in getter if null.")]
            [SecuritySafeCritical] 
            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.
//-----------------------------------------------------------------------------
namespace System.Runtime.Serialization
{ 
    using System.Diagnostics;
    using System.Security; 
 
    #if USE_REFEMIT
    public static class SerializationTrace 
    #else
    static class SerializationTrace
    #endif
    { 
        [Fx.Tag.SecurityNote(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
        { 
            [Fx.Tag.SecurityNote(Critical = "Fetches the critical codeGen field.", 
                Safe = "Get-only properties only needs to be protected for write; initialized in getter if null.")]
            [SecuritySafeCritical] 
            get
            {
                if (codeGen == null)
                    codeGen = new TraceSource("System.Runtime.Serialization.CodeGeneration"); 
                return codeGen;
            } 
        } 
    }
} 



// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

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