Get Assembly Trademark - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Get Assembly Trademark

Demo Code

// The MIT License
using System.Runtime.InteropServices;
using System.Reflection;
using System.Linq;
using System;//from ww  w  .  j  a  v  a2 s . co m

public class Main{
        public static string GetAssemblyTrademark(this Assembly assembly)
        {
            var query = from trademarks in assembly.GetCustomAttributes<AssemblyTrademarkAttribute>()
                        select trademarks;

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

            return "";
        }
}

Related Tutorials