Conversion of ByteBuffer in Xamarin.Android

余生长醉 提交于 2021-01-28 11:52:08

问题


How to convert the following code to C# from Android (Java)?

ByteBuffer bb;

Type = bb.GetInt();

I tried to change this to C# as

Type = bb.Int;

but I am getting wrong values. Please let me know how to convert Java code to C# code


回答1:


See here:

https://developer.xamarin.com/api/type/Java.Nio.ByteBuffer/

You can use

(int)(bb.Get());

Get the value as a sbyte and cast to integer.



来源:https://stackoverflow.com/questions/43117553/conversion-of-bytebuffer-in-xamarin-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!