CSharp examples for System:Byte
Converts the given input string to a byte array.
// TelerikAcademy.com. All rights reserved. using System.Text.RegularExpressions; using System.Text; using System.Security.Cryptography; using System.Linq; using System.Globalization; using System.Collections.Generic; using System;/* w w w . j a v a2s .com*/ public class Main{ /// <summary> /// Converts the given input string to a byte array. /// </summary> /// <param name="input">Input string.</param> /// <returns>Returns the byte converted array.</returns> public static byte[] ToByteArray(this string input) { var bytesArray = new byte[input.Length * sizeof(char)]; Buffer.BlockCopy(input.ToCharArray(), 0, bytesArray, 0, bytesArray.Length); return bytesArray; } }