Error to convert String to Byte[ ]

RomuloVielRomuloViel USMember ✭✭
         `   alert2.Clicked += (object sender2, UIButtonEventArgs e2) => {

                        if(e2.ButtonIndex == 0){

                            string vai = alert2.GetTextField (0).Text;
                            Console.WriteLine(vai);

                            byte[] bit = Encoding.UTF8.GetBytes(vai);
                            Console.WriteLine(bit);
                            //bit = Convert.ToBase64String({vai});

                            foreach (var charac in characteristic.Service.Characteristics) {
                                characteristic.Service.Peripheral.WriteValue (NSData.FromArray (bit),
                                    charac, CBCharacteristicWriteType.WithoutResponse);
                            }

                        }

                    };  `

I'm taking the text from UIAlertView, when I use ""Console.WriteLine(vai); return to me the right value, like 002, 001, 1, 2 or anything else. But when I convert the string to byte, "byte[] bit = Encoding.UTF8.GetBytes(vai);", in the output returns "System.Byte[]"

and not the value...My app doesn't work!

Best Answer

Answers

Sign In or Register to comment.