Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Problem with nullable property of object

0
0
Hi,

There is problem with is Nothing keyword in VBScript when object property is null. In my case
MyClass.Class2 property is null
public class MyClass
{
    public MyClass2 Class2 { get; set; } 
}

public class MyClass2
{
     
}

using(var scripter = new VBScriptEngine(WindowsScriptEngineFlags.EnableDebugging))
{
    scripter.Script.Class1 = new MyClass();
    scripter.Execute(@"
            function Test
            if Class1.Class2 is Nothing then 
                Test = true
            else 
                Test = false
            end if
            end function ");
    Console.WriteLine(scripter.Script.Test());  
}
Regards,

Igor

Viewing all articles
Browse latest Browse all 2297