Get Assembly Configuration - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Get Assembly Configuration

Demo Code

// The MIT License
using System.Runtime.InteropServices;
using System.Reflection;
using System.Linq;
using System;//from   w  ww  .  j  a va  2 s .  com

public class Main{
        public static string GetAssemblyConfiguration(this Assembly assembly)
        {
            var query = from configurations in assembly.GetCustomAttributes<AssemblyConfigurationAttribute>()
                        select configurations;

            if(1 == query.Count())
            {
                return query.First().Configuration;
            }

            return "";
        }
}

Related Tutorials