public string ToNative(string var) { if (IGen == null) { return(String.Empty); } if (ElementType.Length > 0) { string args = ", typeof (" + ElementType + "), " + (owned ? "true" : "false") + ", " + (elements_owned ? "true" : "false"); var = "new " + IGen.QualifiedName + "(" + var + args + ")"; } else if (is_null_term) { return(String.Format("GLib.Marshaller.StringArrayToNullTermPointer ({0})", var)); } if (IGen is IManualMarshaler) { return((IGen as IManualMarshaler).AllocNative(var)); } else if (IGen is ObjectGen && owned) { return(var + " == null ? IntPtr.Zero : " + var + ".OwnedHandle"); } else if (IGen is OpaqueGen && owned) { return(var + " == null ? IntPtr.Zero : " + var + ".OwnedCopy"); } else { return(IGen.CallByName(var)); } }