/// <summary>split the boxed representation of a boxedValueType into unboxed + attributes</summary> /// <remarks> /// attention: make sure, this is not called before all involved boxed types are completetly created; /// otherwise type couldn't be loaded from assembly? /// </remakrs> protected override void SplitBoxedForm(string boxedValueRepId) { string separatedClsTypeName = (string)GetCompactClsType().InvokeMember(BoxedValueBase.GET_FIRST_NONBOXED_TYPENAME_METHODNAME, BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly, null, null, new System.Object[0]); // check, if separatedClsTypeName is in Consturction Type separatedClsType = m_typeManager.GetTypeFromBuildModule(separatedClsTypeName); if (separatedClsType != null) { // this prevents possible TypeLoadException, when separated is not fully defined, // thrown by base implementation BoxedValueAttribute boxAttr = new BoxedValueAttribute(boxedValueRepId); CustomAttributeBuilder[] separatedAttrs = new CustomAttributeBuilder[] { boxAttr.CreateAttributeBuilder() }; SetSeparated(separatedClsType, separatedAttrs, new object[] { boxAttr }); } else { // not know by ModuleBuilder -> possibly in an extern assembly -> load type directly instead of byName base.SplitBoxedForm(boxedValueRepId); } }
public object read_boxed(BoxedValueAttribute attr, Type boxedType, AttributeExtCollection boxedTypeAttrs) { if (boxedTypeAttrs == null) { boxedTypeAttrs = AttributeExtCollection.EmptyCollection; } boxedTypeAttrs = boxedTypeAttrs.MergeAttribute(attr); return(Unmarshal(boxedType, boxedTypeAttrs, m_cdrIn)); }
public void write_boxed(object val, BoxedValueAttribute attr) { Marshal(val.GetType(), new AttributeExtCollection(new Attribute[] { attr }), val, m_cdrOut); }