Adding Custom Marshalers
To apply a user-defined custom marshaler to a parameter or field such as the following:
class [MyLib]IStream s
you must change the data type appropriately and add a special form of MarshalAsAttribute, as follows:
class [mscorlib]System.IO.Stream marshal(custom("StreamMarshaler, MyCustomMarshalers, Version=22.214.171.124, Culture=neutral, PublicKeyToken=ada367530715d2a9", "")) s
The first string inside marshal(custom(...)) must contain the fully-qualified marshaler name and its assembly. The second string is a marshaler-specific cookie.