Forum: IronRuby nil != null ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ivan P. (Guest)
on 2009-05-01 12:19
(Received via mailing list)
Hi
I had specs that used to work but now apparently they don't anymore.
I'd expect that a nil from ruby maps to null in C# but this doesn't seem
to
be the case.


I'm using the following code


        public static bool IsNotNull(this object value)
        {
            return value != null;
        }

        public static bool IsNull(this object value)
        {
            return value == null;
        }

>>> ObjectExtensions.is_null(nil)
:0: can't convert NilClass into Object (TypeError)

I'd expect it to return true ;)

---
Author of IronRuby in Action (http://manning.com/carrero)
This topic is locked and can not be replied to.