Get referenced value from native

Hey folks,

I wondered how to call a RedM Native, like GetDraftAnimalCount (0xA19447D83294E29F) that returns values by reference in C#.

Normaly, i would call it like this:

....
    int expected = 0;
    int actual = 0;
    Function.Call<bool>((Hash)0xA19447D83294E29F, vehicle, ref expected, ref actual);
    Debug.WriteLine($"E: {expected} A: {actual}");

But “Function.Call” cannot handle a reference object.

Is there a way to get the referenced values (expected and actual in the example)?

Kind regards

Okay, found a solution by myself:

int expected = new OutputArgument();
    int actual = new OutputArgument();
    Function.Call<bool>((Hash)0xA19447D83294E29F, vehicle, expected, actual);
    Debug.WriteLine($"E: {expected.GetResult<int>()} A: {actual.GetResult<int>()}");