зеркало из https://github.com/mono/mail-archives.git
103 строки
4.0 KiB
HTML
103 строки
4.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-osx] How to pass nil?
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20How%20to%20pass%20nil%3F&In-Reply-To=8F7649E4-6735-492B-979A-3C74E6AE815E%40tarkvara.org">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="004445.html">
|
|
<LINK REL="Next" HREF="004447.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-osx] How to pass nil?</H1>
|
|
<B>kjpou</B>
|
|
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20How%20to%20pass%20nil%3F&In-Reply-To=8F7649E4-6735-492B-979A-3C74E6AE815E%40tarkvara.org"
|
|
TITLE="[Mono-osx] How to pass nil?">kjpou at pt.lu
|
|
</A><BR>
|
|
<I>Sun Jul 31 05:29:10 EDT 2011</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="004445.html">[Mono-osx] How to pass nil?
|
|
</A></li>
|
|
<LI>Next message: <A HREF="004447.html">[Mono-osx] How to pass nil?
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#4446">[ date ]</a>
|
|
<a href="thread.html#4446">[ thread ]</a>
|
|
<a href="subject.html#4446">[ subject ]</a>
|
|
<a href="author.html#4446">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>Eric
|
|
|
|
If the parameter you are passing can be Null as per the docs then the
|
|
bindings should be changed to reflect that.
|
|
|
|
When you find the parameter that can be null you will have to specify
|
|
[NullAllowed] for the parameter.
|
|
|
|
Example:
|
|
|
|
[Export ("colorUsingColorSpaceName:")]
|
|
NSColor UsingColorSpace ([NullAllowed] string colorSpaceName);
|
|
|
|
The parameter colorSpaceName can be pass a null value so the parameter
|
|
is marked as [NullAllowed] in the method declaration.
|
|
|
|
For properties you can do the same thing.
|
|
|
|
Example:
|
|
|
|
[Export ("target"), NullAllowed]
|
|
NSObject Target { get; set; }
|
|
|
|
The Target property accepts null values so for the Property definition
|
|
you specify the NullAllowed attribute in the Export.
|
|
|
|
Kenneth
|
|
|
|
On 7/31/11 4:53 AM, Eric J. M. Smith wrote:
|
|
><i> Greetings,
|
|
</I>><i>
|
|
</I>><i> Another newbie question about the MonoMac bindings.
|
|
</I>><i>
|
|
</I>><i> I've found that a couple of methods throw an "Argument cannot be null" error even though the Apple docs state that they should be able to take nil as an argument. I take it that it is a limitation of the current MonoMac bindings. Given that, what's the best way to deal with this?
|
|
</I>><i>
|
|
</I>><i> For some cases, the ugly solution of allocating a temporary object (e.g. :myWindow.OrderOut(new NSObject())") seems to work. But for other methods, a nil parameter has a special significance in the API... what's the best practice for passing nil in those cases?
|
|
</I>><i>
|
|
</I>><i> Thanks,
|
|
</I>><i>
|
|
</I>><i> Eric Smith
|
|
</I>><i> Tarkvara Design Inc.
|
|
</I>><i> _______________________________________________
|
|
</I>><i> Mono-osx mailing list
|
|
</I>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">Mono-osx at lists.ximian.com</A>
|
|
</I>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">http://lists.ximian.com/mailman/listinfo/mono-osx</A>
|
|
</I>><i>
|
|
</I></PRE>
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="004445.html">[Mono-osx] How to pass nil?
|
|
</A></li>
|
|
<LI>Next message: <A HREF="004447.html">[Mono-osx] How to pass nil?
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#4446">[ date ]</a>
|
|
<a href="thread.html#4446">[ thread ]</a>
|
|
<a href="subject.html#4446">[ subject ]</a>
|
|
<a href="author.html#4446">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
|
|
mailing list</a><br>
|
|
</body></html>
|