Skip to content

NullableValueType

Mehdi Mohammadi edited this page Dec 30, 2013 · 1 revision

In NativeMode mode we must transform Java Integer class to C# int type. But Integer is a class and can be assigned by null value, whereas int type in C# is a value type and can't be assigned by null value. So we simulate null value by MinValue field.

[Java]


public class Test
{
    public void Method()
    {
        Integer a = null; 
        bool b = (a == null);
    }
}

[C#]


public class Test
{
    public void Method()
    {
        int a = System.Int32.MinValue; 
        bool b = (a == System.Int32.MinValue);
    }
}
Clone this wiki locally