We Recommend

Accelerated C# 2008 Accelerated C# 2008
This book is both a rapid tutorial and a permanent reference. You’ll quickly master C# syntax while learning how the CLR simplifies many programming tasks. You’ll also learn best practices that ensure your code will be efficient, reusable, and robust. Why spend months or years discovering the best ways to design and code C# when this book will show you how to do things the right way, right from the start?


Posted By

Anthony on 06/17/08


Tagged

array String byte convert


Versions (?)


Convert String to Byte Array


Published in: C# 


  1. public static byte[] ToByteArray(string str)
  2. {
  3. System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
  4. return encoding.GetBytes(str);
  5. }

Report this snippet 

You need to login to post a comment.