StringHelper.cs 396 B

1234567891011121314151617181920
  1. using System.Collections.Generic;
  2. using System.Text;
  3. namespace Helper
  4. {
  5. public static class StringHelper
  6. {
  7. public static IEnumerable<byte> ToBytes(this string str)
  8. {
  9. byte[] byteArray = Encoding.Default.GetBytes(str);
  10. return byteArray;
  11. }
  12. public static byte[] ToByteArray(this string str)
  13. {
  14. byte[] byteArray = Encoding.Default.GetBytes(str);
  15. return byteArray;
  16. }
  17. }
  18. }