Get Assembly Title - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Get Assembly Title

Demo Code

// The MIT License
using System.Runtime.InteropServices;
using System.Reflection;
using System.Linq;
using System;//from   w  w w  . j a  v  a  2 s  .c om

public class Main{
        public static string GetAssemblyTitle(this Assembly assembly)
        {
            var query = from titles in assembly.GetCustomAttributes<AssemblyTitleAttribute>()
                        select titles;

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

            return "";
        }
}

Related Tutorials