namespace System.Reflection.Emit {
-#if NET_2_0
[Obsolete ("An alternate API is available: Emit the MarshalAs custom attribute instead.")]
[ComVisible (true)]
-#endif
[Serializable]
+ [StructLayout (LayoutKind.Sequential)]
public sealed class UnmanagedMarshal {
+#pragma warning disable 169, 414
private int count;
private UnmanagedType t;
private UnmanagedType tbase;
Type marshaltyperef;
private int param_num;
private bool has_size;
+#pragma warning restore 169, 414
private UnmanagedMarshal (UnmanagedType maint, int cnt) {
count = cnt;
return new UnmanagedMarshal (unmanagedType, unmanagedType);
}
- /* this one is missing from the MS implementation */
- public static UnmanagedMarshal DefineCustom (Type typeref, string cookie, string mtype, Guid id) {
+ internal static UnmanagedMarshal DefineCustom (Type typeref, string cookie, string mtype, Guid id) {
UnmanagedMarshal res = new UnmanagedMarshal (UnmanagedType.CustomMarshaler, UnmanagedType.CustomMarshaler);
res.mcookie = cookie;
res.marshaltype = mtype;
res.guid = id.ToString ();
return res;
}
-
+
// sizeConst and sizeParamIndex can be -1 meaning they are not specified
internal static UnmanagedMarshal DefineLPArrayInternal (UnmanagedType elemType, int sizeConst, int sizeParamIndex) {
UnmanagedMarshal res = new UnmanagedMarshal (UnmanagedType.LPArray, elemType);