Get Assembly Company - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Get Assembly Company

Demo Code

// The MIT License
using System.Runtime.InteropServices;
using System.Reflection;
using System.Linq;
using System;/*from ww  w  .  ja va2s. c  om*/

public class Main{
        public static string GetAssemblyCompany(this Assembly assembly)
        {
            var query = from companies in assembly.GetCustomAttributes<AssemblyCompanyAttribute>()
                        select companies;

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

            return "";
        }
}

Related Tutorials