Page 1 of 1

Preferred Hex conversion in C#

Posted: Mon 11. Sep 2017, 18:59
by snieves77
Is there a preferred hex conversion for can data? In c# I'm using Convert.ToInt32(fields[0], 16). Is this correct? Any help would be greatly appreciated.

Re: Preferred Hex conversion in C#

Posted: Tue 12. Sep 2017, 11:27
by K.Wagner
Hello,

yes. It is OK. Check the PCAN-Basic samples. In there you will find a lot of code in C# (and other languages). For instance:

Code: Select all

// We configurate the Message.  The ID,
// Length of the Data, Message Type
// and the data
//
CANMsg.ID = Convert.ToUInt32(txtID.Text, 16);

Re: Preferred Hex conversion in C#

Posted: Tue 12. Sep 2017, 17:13
by snieves77
Perfect, thanks!