Type.IsCOMObject : Type « System « C# / C Sharp by API






Type.IsCOMObject

    

using System;
using System.Reflection;

public interface IFaceOne
{
  void MethodA();
}

public interface IFaceTwo
{
  void MethodB();
}

public class MyClass: IFaceOne, IFaceTwo
{
  public enum MyNestedEnum{}
  
  public int myIntField;
  public string myStringField;

  public void myMethod(int p1, string p2)
  {
  }

  public int MyProp
  {
    get { return myIntField; }
    set { myIntField = value; }
  }

  void IFaceOne.MethodA(){}
  void IFaceTwo.MethodB(){}
}

public class MainClass
{
  public static void Main(string[] args)
  {
    MyClass f = new MyClass();

    Type t = f.GetType();

    Console.WriteLine("Full name is: {0}", t.FullName);
    Console.WriteLine("Base is: {0}", t.BaseType);
    Console.WriteLine("Is it abstract? {0}", t.IsAbstract);
    Console.WriteLine("Is it a COM object? {0}", t.IsCOMObject);
    Console.WriteLine("Is it sealed? {0}", t.IsSealed);
    Console.WriteLine("Is it a class? {0}", t.IsClass);
    
  }
}

   
    
    
    
  








Related examples in the same category

1.Type.BaseType
2.Type.ContainsGenericParameters
3.Type.FullName
4.Type.GetConstructor
5.Type.GetCustomAttributes
6.Type.GetEvents()
7.Type.GetFields()
8.Type.GetGenericArguments()
9.Type.GetGenericTypeDefinition()
10.Type.GetInterfaces()
11.Type.GetMethod(String methodName);
12.Type.GetMethods()
13.Type.GetProperties()
14.Type.GetType(String typeName)
15.Type.GetType(String typeName, true)
16.Type.GetType(String typeName, true, true);
17.Type.IsAbstract
18.Type.IsClass
19.Type.IsEnum
20.Type.IsGenericTypeDefinition
21.Type.IsSealed
22.Type.MakeGenericType
23.Type.Name
24.Type.ReflectionOnlyGetType
25.Type.UnderlyingSystemType