sagifogel/Ramda.NET

Usage question

mribichich opened this issue · 3 comments

Hi there, sorry to bother, this could be a dump question but I cant figure it out.

Im trying to use R.IsNil like this: var result = R.Not(R.IsNil(someObject)) but it doesnt work. SomeObject is null so result should be false but it gives me an exception: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'The best overloaded method match for 'Ramda.NET.R.Not(bool)' has some invalid arguments'

How is it that I have to use the lib?

thanks!

Because of an internal implementation detail regarding currying, you cannot use null in the library.
In order to use null you should use the built in R.@null field, therefore your expression should be changed to:

var someObject = R.@null;

R.Not(R.IsNil(someObject));

Ok great, then how can I check whether an object is nil or not?
the idea is that you dont know the value of someObject, but I want to know if its not null basically
thanks!

Assign all of your variables the value R.@null upon declaration.

dynamic someObject = R.@null;