我正在尝试在C#中实现Crc16.我已经尝试过很多不同的实现,但是大多数都给了我不同的值.以下是我已经使用过的一些代码.
private static int POLYNOMIAL = 0x8408;
private static int PRESET_VALUE = 0xFFFF;
public static int crc16(byte[] data)
{
int current_crc_value = PRESET_VALUE;
for (int i = 0; i < data.Length; i++)
{
current_crc_value ^= data[i] & 0xFF;
for (int j = 0; j < 8; j++)
{
if ((current_crc_value & 1) != 0)
{
current_crc_value = (current_crc_value >> 1) ^ POLYNOMIAL;
}
else
{
current_crc_value = current_crc_value >> 1;
}
}
}
current_crc_value = ~current_crc_value;
return current_crc_value & 0xFFFF; …Run Code Online (Sandbox Code Playgroud) 这个问题很简单,但我对此一无所知.如何在代码隐藏中将边距设置为窗口小部件.
我在Xamarin的网站上找到了这个文档,但我无法将其用于ImageView
我也在我的ImageView中尝试过Layout()方法,但它没有用.
ImageView imgView = FindViewById<ImageView>(Resource.Id.imageView);
imgView.Layout(10, 10, 10, 10);
Run Code Online (Sandbox Code Playgroud)