问题描述
我真的不太了解字节/位等等。
问题,如果我定义了一个byte(),我该如何向它添加一个字节?
我想要的是我有一个字节数组,我循环该数组,查看该字节的
值,如果该字节是我想要什么,然后我将它插入新的字节()中。
。我怎么能这样做?
-
亲切的问候
郭启铮
guoqi AT meetholland dot com
I am really do not know so much about byte/bit, etc.
Question, if I defined a byte(), how can I add a single byte to it?
what I want is that I have an array of bytes, I loop that array, look at the
value of that individual byte, if that byte is what I want, then I insert it
into the new byte(). How can I do it?
--
Kind regards
Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.com
推荐答案
---
外发邮件经过无病毒认证。
由AVG反病毒系统检查(。
版本:6.0.754 /病毒数据库:504 - 发布日期:9 / 6/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.754 / Virus Database: 504 - Release Date: 9/6/2004
在这种情况下,''ReDim保留''是要走的路。
-
MS Herfried K. Wagner
MVP< URL:http ://dotnet.mvps.org/>
VB< URL:http://dotnet.mvps.org/dotnet/faqs/>
In this case, ''ReDim Preserve'' is the way to go.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
对于可调整大小的数组,你真的想使用
System.Collections.ArrayList。在你用Array
想要的内容填充ArrayList之后,你总是可以转换回一个
普通字节()。
如果你只需要一次添加一个字节,那么ReDim Preserve将会工作正常,但听起来你是在循环中这样做了,并且
$如果你在这里依赖ReDim,b $ b的表现会很糟糕。
For resizable arrays, you really want to use
System.Collections.ArrayList. You can always convert back into an
ordinary byte() after you''ve filled the ArrayList with the contents you
want.
If you only need to add a single byte one time, then ReDim Preserve will
work fine, but it sounds like you''re doing this in a loop, and
performance will be terrible if you rely on ReDim here.
这篇关于向byte()添加单个字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!