一个字节的ID也会影响大小吗? [英] Will the ID of a byte affect the size too?

查看:111
本文介绍了一个字节的ID也会影响大小吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Codeproject,



假设我有两个字节:

  byte 一个=  0 ; 
byte 两个= 1 ;



如果我保存这些,那么一个小于2,因为字节值本身较少?我的意思是,一切都是用bitcode写的。但是字节的所有位都是相同的长度,例如:

第一位=  010101 ; 
bit 2 = 011101 ;



或者更像是这样:

第一位=  010 ; 
位2 = 010011 ;



我不确定我是否能够以一种可以理解的方式问这个问题但是,字节有不同的位长吗?

解决方案

一个输入为 byte 的值将始终使用至少8位:积分类型表(C#参考) [ ^ ]。



问候,



- Manfred

您将字节与表示字节的字符串混淆。这非常令人沮丧。唯一可以做到的事情是:从初学者那里学习一些计算机。回答你的特定问题对你没有帮助。相反,您应该了解数据在原理上的表示方式,变量和类型的工作方式,.NET的作用,语言和编译器的作用。对不对,你没有线索。



-SA


任何值将填充0'(对于正数或无符号数)或1'(对于负有符号数)以适合其所在值的大小(8位为字节,16为简称,等)。

Hello Codeproject,

Assuming I have two bytes:

byte One = 0;
byte Two = 1;


If I save these, will One be less than two since the byte value itself is less? I mean, everything is written in bitcode. But are all the bits of the bytes the same length such as:

bit One = 010101;
bit Two = 011101;


Or would it be more like this:

bit One = 010;
bit Two = 010011;


I''m not sure if I''m able to ask this in an understandable way but, do bytes have different bitlengths?

解决方案

A value typed as byte will always use at least 8 bits: Integral Types Table (C# Reference)[^].

Regards,

— Manfred


You are confusing bytes with strings representing bytes. This is very frustrating. The only one thing can come: learn some computing from the very beginner. Answering your particular question won''t help you. Instead, you should understand how data is represented in principle, how variables and types work, what .NET does, what the language and a compiler do. Right not, you don''t have a clue.

—SA


Any value will be padded with 0''s (for a positive or unsigned number) or 1''s (for a negative signed number) to fit the size of the value it''s in (8 bits for bytes, 16 for short, etc.).


这篇关于一个字节的ID也会影响大小吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆