سؤال

Suppose I have the following C# code that accepts a COM object with IEnumVARIANT interface:

public void EnumeratorParameter( 
    [MarshalAs(UnmanagedType.CustomMarshaler, 
     MarshalTypeRef = typeof(EnumeratorToEnumVariantMarshaler))] 
    IEnumerator enumerator) { }

To marshal it, I need to add a reference to CustomMarshalers.dll library. However, unlike with mscorlib.dll, this library is referenced not in with AssemblyRef metadata table but in blob heap via FieldMarshal table. Why the reference via blob is used?

هل كانت مفيدة؟

المحلول

Because the reference appears in an [attribute]. The attribute data that's used when the attribute class is instantiated is stored in the blob table. More about that in this answer.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top