Click here to Skip to main content
15,914,594 members
Home / Discussions / C#
   

C#

 
QuestionHow to use bytes in bytes buffer? Pin
Member 474292223-Jul-09 23:33
Member 474292223-Jul-09 23:33 
Hello,
i was trying to simplify my code but i have a problem with the code here:
public void Send(byte a, byte b, byte c)
     {
         byte[] ab = new byte[3];
         ab[0] = a;
         ab[1] = b;
         ab[2] = c;
         ab[3] = a ^ b ^ c;
         serialPort1.Open();
         serialPort1.Write(ab, 0, 3);
         serialPort1.Close();
     }

When is use this code there is an error in this line:
ab[3] = a ^ b ^ c;

the error is:
Error 1 Cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?) C:\Users\***\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs 27 21 WindowsFormsApplication1

Is there some one that can help me?
AnswerRe: How to use bytes in bytes buffer? Pin
DaveyM6923-Jul-09 23:39
professionalDaveyM6923-Jul-09 23:39 
GeneralRe: How to use bytes in bytes buffer? Pin
Member 474292223-Jul-09 23:41
Member 474292223-Jul-09 23:41 
AnswerRe: How to use bytes in bytes buffer? Pin
Muhammad Mazhar23-Jul-09 23:45
Muhammad Mazhar23-Jul-09 23:45 
GeneralRe: How to use bytes in bytes buffer? Pin
Member 474292223-Jul-09 23:52
Member 474292223-Jul-09 23:52 
GeneralRe: How to use bytes in bytes buffer? Pin
harold aptroot24-Jul-09 4:06
harold aptroot24-Jul-09 4:06 
GeneralRe: How to use bytes in bytes buffer? Pin
musefan24-Jul-09 0:03
musefan24-Jul-09 0:03 
GeneralRe: How to use bytes in bytes buffer? Pin
Member 474292224-Jul-09 1:14
Member 474292224-Jul-09 1:14 
AnswerRe: How to use bytes in bytes buffer? Pin
0x3c024-Jul-09 0:39
0x3c024-Jul-09 0:39 
AnswerRe: How to use bytes in bytes buffer? Pin
Luc Pattyn24-Jul-09 0:49
sitebuilderLuc Pattyn24-Jul-09 0:49 
QuestionHow to make a Component like MSN status label? Pin
Don.Y23-Jul-09 23:19
Don.Y23-Jul-09 23:19 
AnswerRe: How to make a Component like MSN status label? Pin
DaveyM6923-Jul-09 23:21
professionalDaveyM6923-Jul-09 23:21 
AnswerRe: How to make a Component like MSN status label? Pin
Muhammad Mazhar23-Jul-09 23:38
Muhammad Mazhar23-Jul-09 23:38 
AnswerRe: How to make a Component like MSN status label? Pin
Tamer Oz24-Jul-09 0:21
Tamer Oz24-Jul-09 0:21 
Questiona strange problem with windows service Pin
saeidfarahi23-Jul-09 22:53
saeidfarahi23-Jul-09 22:53 
AnswerRe: a strange problem with windows service Pin
musefan23-Jul-09 23:17
musefan23-Jul-09 23:17 
AnswerRe: a strange problem with windows service Pin
DoctorMick23-Jul-09 23:38
DoctorMick23-Jul-09 23:38 
GeneralRe: a strange problem with windows service Pin
musefan23-Jul-09 23:42
musefan23-Jul-09 23:42 
GeneralRe: a strange problem with windows service Pin
DoctorMick24-Jul-09 0:11
DoctorMick24-Jul-09 0:11 
GeneralRe: a strange problem with windows service Pin
musefan24-Jul-09 0:16
musefan24-Jul-09 0:16 
QuestionACOS3-24 smart card write operation C# Pin
GauravKP23-Jul-09 22:39
professionalGauravKP23-Jul-09 22:39 
AnswerRe: ACOS3-24 smart card write operation C# Pin
Nagy Vilmos23-Jul-09 23:27
professionalNagy Vilmos23-Jul-09 23:27 
AnswerRe: ACOS3-24 smart card write operation C# Pin
stancrm24-Jul-09 0:07
stancrm24-Jul-09 0:07 
QuestionIntPtr to Image ? Pin
Mohammad Dayyan23-Jul-09 22:38
Mohammad Dayyan23-Jul-09 22:38 
AnswerRe: IntPtr to Image ? Pin
stancrm23-Jul-09 22:55
stancrm23-Jul-09 22:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.