Get Assembly Product - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Get Assembly Product

Demo Code

// The MIT License
using System.Runtime.InteropServices;
using System.Reflection;
using System.Linq;
using System;/*from  w ww . jav a  2  s  . c  om*/

public class Main{
        public static string GetAssemblyProduct(this Assembly assembly)
        {
            var query = from products in assembly.GetCustomAttributes<AssemblyProductAttribute>()
                        select products;

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

            return "";
        }
}

Related Tutorials