Which Of The Following C Code Is Used For Conversion Of Hex To #36
Which of the following C# code is used for conversion of hex to string form?</p> <pre><code class="language-csharp" line="1"> static void Main(string[] args) { string testString = "MIKA@?&^"; string normal = ConvertHexToString (hex, System.Text.Encoding.Unicode); Console.WriteLine(normal); Console.ReadLine(); } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs108 CSharp. It can also be found in gs gs108 Data Types, Variables and Operators - Char Types and String Literals - Quiz No.2.
Which of the following C# code is used for conversion of hex to string form?
static void Main(string[] args) { string testString = "MIKA@?&^"; string normal = ConvertHexToString (hex, System.Text.Encoding.Unicode); Console.WriteLine(normal); Console.ReadLine(); }
public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding) { char[] numberChars = hexInput.Length; byte[] bytes = new byte[numberChars / 2]; for (int i = 0; i < numberChars; i += 2) { bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 0), 16); } return encoding.GetString(bytes); }
public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding) { int numberChars = hexInput.Length; byte[] bytes = new byte[numberChars / 2]; for (int i = 0; i < numberChars; i += 2) { bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 2), 16); } return encoding.GetString(bytes); }
public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding) { string numberChars = hexInput.Length; byte[] bytes = new byte[numberChars]; for (int i = 0; i < numberChars; i += 2) { bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 2), 16); } return encoding.GetString(bytes); }
None of the mentioned