How to pass a Nullable`1 type value to a function in AX2012

Hi,

I am implementing a class.  I created the reference without problems.

  void  request.set_securedataexpiry(Nullable`1 value)

How can i pass a value to this Nullable`1 value?

Thanks in advance,

sudha

 

  • Try something like this (example for Nullable<decimal>):

    System.Type nullableType = System.Type::GetType('System.Nullable`1[System.Decimal]');
    System.Object decimalValue = System.Convert::ToDecimal(123);
    System.Object[] paramValues = new System.Object[1]();
    CLRObject nullableValue;
        
    paramValues.SetValue(decimalValue, 0);
    nullableValue = System.Activator::CreateInstance(nullableType, paramValues);
Related
Recommended