vb.net - Working with Byte literals -


I am using the following function to brighten the color value (this is my lambda in code, but not her Should be a differentiated): <25> (by byte as byte) I + (255 - i) \ 2 termination function

T compile, because the compiler defines 255 and 2 as an integer instead of bytes, resulting in type p. Hnank Unfortunately ,, so I just 255B can not write or do.

There are some obvious solutions to this problem:

  Reduce function dysstenatu 255 (Byval I as Byte) Byte Returns I + (CBT (255) - i) \ CByte (2) Termination function  

and

  Reduce function DantTos-255 (Byval I as Byte) Byte Return CByte (i + (255 - i) \ 2) End function  

and

  decrease the function Distance TO225 (ByVal i as byte) Byte dim FF = byte = 255 Byte = 2 returns I + (FF - I) \ two termination function  

The first one is simply plain and ugly, because every has to be literally needed CByte d. Second, calculates in integer and then converts the result into byte, which is fine, but not as spectacular as pure-byte operation. For the third solution, CByte s is not required, but these drawbacks are clear.

Am I missing some (elegant) fourth option which allows me to do without a bit-only-math, disorganizing my formula with sibules

This particular Visual Basic language specification is described in Chapter 2.4.2:

Note is not a type of character for byte because the most natural character will be B, which is hexadecimal literal

Well, it is true I think "Octet" also voted, no doubt. Use Return CByte (...), it is cheaper than ToByte ().


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -