Reputation: 15138
I have a method in Java:
public int getInt() {
IntByReference ibr = new IntByReference();
if (CFLib.INSTANCE.CFNumberGetValue(this, 4, ibr))
return ibr.getValue();
return -1; }
here is the Reference:
How I Can copy this exactly for C#.net?
Upvotes: 0
Views: 266
Reputation: 7061
That 4 there corresponds to the enum value kCFNumberSInt64Type
. Why was that being jammed into a (32 bit) integer? Anyway, it looks like CFNumberGetValue
wants a void*
(C++) for its third parameter.
public int getInt() {
int i;
if (CFLib.INSTANCE.CFNumberGetValue(this, kCFNumberSInt32Type, (IntPtr)i))
return i;
return -1;
}
I don't know if anything needs to be done with the first parameter as I have no idea what this
is.
Upvotes: 1