Marko Apfel

C#, Architecture, QA, Coach, GIS, ArcGIS, ArcObjects

  Home  |   Contact  |   Syndication    |   Login
  144 Posts | 2 Stories | 73 Comments | 4 Trackbacks

News



Twitter | LinkedIn | Xing

Twitter












Article Categories

Archives

Post Categories

BizTalk

C#

Enterprise Library

SAP

SQL Server

Technologie

Friday, November 25, 2011 #

Problem

this code does not work

Type t = typeof(ESRI.ArcGIS.Framework.AppRefClass);
System.Object obj = Activator.CreateInstance(t);

but yet this code

Type t = Type.GetTypeFromCLSID(typeof(ESRI.ArcGIS.Framework.AppRefClass).GUID);
System.Object obj = Activator.CreateInstance(t);

Reason

In the first variant the runtime tries to cast to AppRefClass . This is not possible.

And in the second one, the runtime does not knows anything about AppRefClass. So it leave it as IUnknown.

 

(originally communicated by my co-worker Ralf)