Checks for the DebuggableAttribute on the assembly provided to determine whether it has been built in Debug mode. - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Checks for the DebuggableAttribute on the assembly provided to determine whether it has been built in Debug mode.

Demo Code


using System.Web.Compilation;
using System.Web;
using System.Threading;
using System.Reflection;
using System.Linq;
using System.IO;/* w  w w. ja  v  a  2  s . com*/
using System.Diagnostics;
using System;

public class Main{
        /// <summary>
        /// Checks for the DebuggableAttribute on the assembly provided to determine
        /// whether it has been built in Debug mode.
        /// </summary>
        public static bool AssemblyIsDebugBuild(Assembly assembly)
        {
            return assembly
                .GetCustomAttributes(false)
                .OfType<DebuggableAttribute>()
                .Select(attr => attr.IsJITTrackingEnabled)
                .FirstOrDefault();
        }
}

Related Tutorials