What is an AliasForType?

Aug 18, 2011 at 9:19 AM

I tried to generate one by using a C++/CLI typedef, but that didn't work. Which CLI construct creates an AliasForType?

Best regards,


Aug 18, 2011 at 4:52 PM

These things arise in metadata in two ways: 1) If you build a multi-module assembly, then the public types of non manifest modules are exported to other assemblies by being listed in the type aliases collection. 2) When a type moves from assembly A to assembly B, then the source code for assembly A can add a TypeForwardedToAttribute to create an alias. This way, any legacy code that references the type as a member of assembly A, will be able to still run because the CLR will use the type alias to find out that the type actually lives in assembly B.