Is Assembly COM Visible - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Is Assembly COM Visible

Demo Code

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

public class Main{
        public static bool IsAssemblyCOMVisible(this Assembly assembly)
        {
            var query = from visibles in assembly.GetCustomAttributes<ComVisibleAttribute>()
                        select visibles;

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

            return false;
        }
}

Related Tutorials