如何在不输出的情况下增加一个字节? [英] How do I increment a byte with out casting?

查看:73
本文介绍了如何在不输出的情况下增加一个字节?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我选择Strict时,我想增加一个字节,而且我不希望
想要进行任何投射。下面的代码可以实现,但它很难在

眼睛。


Dim lineNumber As Byte = 0

Dim incrementer As字节= 1


每条线作为线路输入mCollection

lineNumber + =增量器

line.LineNumber.Value = lineNumber

下一页


我想做更多这样的事情


Dim lineNumber As Byte = 0


每条线作为线路输入mCollection

lineNumber + = 1y

line.LineNumber.Value = lineNumber

下一页


其中y是后缀会创建无名临时对象

作为一个值为1的字节。


有没有办法做到这一点?有没有更好的方法来增加一个字节?


谢谢,

Russ

解决方案




你让我很好奇,你为什么要用处理器循环吃命令

这个字节用这种操作,而不是直接在32位计算机累加器寄存器中的正常整数。


Cor


< ko ********* @ hotmail.com> schreef在bericht

新闻:11 ********************** @ i40g2000cwc.googlegr oups.com ...

当我有Option Strict时,我想增加一个字节,而且我不想做任何演员。下面的代码可以实现,但眼睛很难。

Dim lineNumber As Byte = 0
Dim incrementmenter As Byte = 1

每一行As Line In mCollection
lineNumber + = incrementmenter
line.LineNumber.Value = lineNumber
下一页

我想做更像这样的事情

Dim lineNumber As Byte = 0

对于每一行作为行在mCollection中
lineNumber + = 1y
line.LineNumber.Value = lineNumber 接下来

其中y是什么后缀会创建无名的临时对象
作为一个值为1的字节。

有没有办法做到这一点?有没有更好的方法来增加一个字节?

谢谢,
Russ



我老实说不可能告诉你。我正在一个新的地方工作

拖动大量转换后的VB6代码,我假设旧的数据库;

不能证明使用一个字节。我只想解释一下我似乎陷入困境的环境。当我在这里待了一段时间他们

可能会回答我用很好你很聪明

去解决它。


无论如何,有没有办法增加一个看起来不那么的字节< br $>
高飞?


Russ


Cor Ligthert [MVP]写道:

你好,

你让我很好奇,你为什么要使用处理器循环吃命令
用一个字节进行这种操作而不是正常的Integer直接适合累加器寄存器来自32位电脑。

< ko ********* @ hotmail.com> schreef in bericht
新闻:11 ********************** @ i40g2000cwc.googlegr oups.com ...

当我有Option Strict时,我想增加一个字节,而我不想做任何演员。下面的代码可以实现,但眼睛很难。

Dim lineNumber As Byte = 0
Dim incrementmenter As Byte = 1

每一行As Line In mCollection
lineNumber + = incrementmenter
line.LineNumber.Value = lineNumber
下一页

我想做更像这样的事情

Dim lineNumber As Byte = 0

对于每一行作为行在mCollection中
lineNumber + = 1y
line.LineNumber.Value = lineNumber 接下来

其中y是什么后缀会创建无名的临时对象
作为一个值为1的字节。

有没有办法做到这一点?有没有更好的方法来增加一个字节?

谢谢,
Russ




< BLOCKQUOTE>< KO ********* @ hotmail.com> schrieb:

当我选择Strict时我想增加一个字节而且我不想做任何演员。




你不需要做任何明确的演员!


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http://classicvb.org/petition/>

I want to increment a byte when I have Option Strict on and I don''t
want to do any casting. The code below does it but it is hard on the
eyes.

Dim lineNumber As Byte = 0
Dim incrementer As Byte = 1

For Each line As Line In mCollection
lineNumber += incrementer
line.LineNumber.Value = lineNumber
Next

I''d like to do something more like this

Dim lineNumber As Byte = 0

For Each line As Line In mCollection
lineNumber += 1y
line.LineNumber.Value = lineNumber
Next

Where y is what ever suffix would create that nameless temporary object
as a byte with the value of 1.

Is there a way to do this? Is there a better way to increment a byte?

Thanks,
Russ

解决方案

Hi,

You make me curious, why are you using a processor cycles eating command
with a byte for this kind of operations and not the normal Integer that fits
directly in the accumulatorregisters from a 32bit computer.

Cor

<ko*********@hotmail.com> schreef in bericht
news:11**********************@i40g2000cwc.googlegr oups.com...

I want to increment a byte when I have Option Strict on and I don''t
want to do any casting. The code below does it but it is hard on the
eyes.

Dim lineNumber As Byte = 0
Dim incrementer As Byte = 1

For Each line As Line In mCollection
lineNumber += incrementer
line.LineNumber.Value = lineNumber
Next

I''d like to do something more like this

Dim lineNumber As Byte = 0

For Each line As Line In mCollection
lineNumber += 1y
line.LineNumber.Value = lineNumber
Next

Where y is what ever suffix would create that nameless temporary object
as a byte with the value of 1.

Is there a way to do this? Is there a better way to increment a byte?

Thanks,
Russ



I honestly couldn''t tell you. I''m working at a new place that is
dragging along a lot of converted VB6 code and I assume old databases;
not that that justifies using a byte. I only mean to explain the
environment I seem to be stuck in. When I''ve been here a while they
might answer my asking that question with a "Fine you''re so smart
go fix it".

Regardless, is there any way to increment a byte that doesn''t look so
goofy?

Russ

Cor Ligthert [MVP] wrote:

Hi,

You make me curious, why are you using a processor cycles eating command
with a byte for this kind of operations and not the normal Integer that fits
directly in the accumulatorregisters from a 32bit computer.

Cor

<ko*********@hotmail.com> schreef in bericht
news:11**********************@i40g2000cwc.googlegr oups.com...

I want to increment a byte when I have Option Strict on and I don''t
want to do any casting. The code below does it but it is hard on the
eyes.

Dim lineNumber As Byte = 0
Dim incrementer As Byte = 1

For Each line As Line In mCollection
lineNumber += incrementer
line.LineNumber.Value = lineNumber
Next

I''d like to do something more like this

Dim lineNumber As Byte = 0

For Each line As Line In mCollection
lineNumber += 1y
line.LineNumber.Value = lineNumber
Next

Where y is what ever suffix would create that nameless temporary object
as a byte with the value of 1.

Is there a way to do this? Is there a better way to increment a byte?

Thanks,
Russ




<ko*********@hotmail.com> schrieb:

I want to increment a byte when I have Option Strict on and I don''t
want to do any casting.



You don''t need to do any explicit casting!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


这篇关于如何在不输出的情况下增加一个字节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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