hello,
how can i convert in c# from byte (like 50) to int
i try to do this code, but it didn't convert!!!:
for (int i=3;i<14;i++)Data += ((
int) e.Bufferthank you,
moria
hello,
how can i convert in c# from byte (like 50) to int
i try to do this code, but it didn't convert!!!:
for (int i=3;i<14;i++)Data += ((
int) e.Bufferthank you,
moria
convert from byte to int
chenwen
byte implicitly converts to int. You do not need to cast the byte if you add it to an int.
int nVal = 10;
byte byVal = 50;
nVal = nVal + byVal; // nVal will be 10+50=60
If Data is of type int you can write it like
Data += e.Buffer( i );
If you would like to visualise that there is a cast happening you can write it like this
Data += (int)e.Buffer( i );