Here’s an alternative since you don’t like the cast to int:
foreach(byte b in System.Text.Encoding.UTF8.GetBytes(str.ToCharArray())) Console.Write(b.ToString());
Related Posts:
- How can I convert String to Int?
- Convert int to string?
- Converting string to byte array in C#
- How can I add ” character to a multi line string declaration in C#?
- C# List
to string with delimiter - Convert a list of strings to a single string
- C#: how to get first char of a string?
- How to initialize a list of strings (List
) with many string values - What does {0} mean when found in a string in C#?
- C# – Illegal characters in path
- How can I fix the error : “Unreachable Code Detected”
- C# – How to convert string to char?
- Escape double quotes in a string
- Creating a comma separated list from IList
or IEnumerable - Fastest way to remove first char in a String
- Checking if a string array contains a value, and if so, getting its position
- Substring index and length must refer to a location within the string
- Case insensitive ‘Contains(string)’
- Most efficient way to remove special characters from string
- Is there an equivalent to the Scanner class in C# for strings?
- Adding a newline into a string in C#
- How to format a string as a telephone number in C#
- How to convert UTF-8 byte[] to string
- .NET String.Format() to add commas in thousands place for a number
- How would you count occurrences of a string (actually a char) within a string?
- C# equivalent to Java’s charAt()?
- What is a quick way to force CRLF in C# / .NET?
- Check if a string is a palindrome
- Convert string to decimal, keeping fractions
- Convert JSON String to JSON Object c#
- Convert an array to string
- Unrecognized escape sequence for path string containing backslashes
- An existing connection was forcibly closed by the remote host
- Unexplained crashes related to ntdll.dll
- I am getting Failed to load resource: net::ERR_BLOCKED_BY_CLIENT with Google chrome
- What is parsing?
- How to fix “HTTP Error 400. The size of the request headers is too long” error from azure cloud services?
- Invisible characters – ASCII
- Could not load file or assembly or one of its dependencies
- LINQ’s Distinct() on a particular property
- Priority queue in .Net
- What is the difference between int, Int16, Int32 and Int64?
- Adding values to a C# array
- Input string was not in a correct format
- The request was aborted: Could not create SSL/TLS secure channel
- Unable to connect to web server ‘IIS Express’
- Twilio TwilioRestClient does not contain a definition for SendSmsMessage
- How to convert byte array to string
- ASP.NET Core Dependency Injection error: Unable to resolve service for type while attempting to activate
- Nullable object must have a value?
- Sequence contains no elements?
- Best way to generate a random float in C#
- Check if list is empty in C#
- What is clr.dll on .Net framework and what does it do?
- How can I secure passwords stored inside web.config?
- Visual Studio says “Method must have a return type”
- How to Use TextureBrush for painting an Image
- C# compiler error: “not all code paths return a value”
- How do I read and parse an XML file in C#?
- How to fix “namespace x already contains a definition for x” error? Happened after converting to VS2010
- How do I create a Shared Code project (.shproj)
- What is the easiest/best/most correct way to iterate through the characters of a string in Java?
- OnCollisionEnter2D not being executed?
- The calling thread cannot access this object because a different thread owns it
- Convert JSON String To C# Object
- How can I fix Visual Studio 2015 exception Microsoft.vshup.server.httphostx64.exe has stopped working when run project
- Merge two (or more) lists into one, in C# .NET
- Why should I use IHttpActionResult instead of HttpResponseMessage?
- Convert integer to binary in C#
- HTML.ActionLink method
- num1 >= 0x80 – What is 0x80?
- There is already an open DataReader associated with this Command which must be closed first
- Merging two arrays in .NET
- C# syntax to initialize custom class/objects through constructor params in array?
- Unable to connect to any of the specified mysql hosts. C# MySQL
- String was not recognized as a valid DateTime ” format dd/MM/yyyy”
- How to pass data (and references) between scenes in Unity
- Constructor of an abstract class in C#
- Catch multiple exceptions at once?
- How to delete a file after checking whether it exists
- c# Show Windows Form
- Equivalent of console.log in C#
- How to get the URL of the current page in C#
- C# Debug – cannot start debugging because the debug target is missing
- ‘namespace’ but is used like a ‘type’
- How to properly make a http web GET request
- Strip double quotes from a string in .NET
- Simulating Key Press C#
- No overload for method ” takes 1 argument
- Best way to “push” into C# array
- Is it possible to install a C# compiler without Visual Studio?
- Playing a MP3 file in a WinForm application
- How to solve Operator ‘!=’ cannot be applied to operands of type ‘T’ and ‘T’
- Best way to randomize an array with .NET
- Encrypt and decrypt a string in C#?
- Key Value Pair List
- Using .Select and .Where in a single LINQ statement
- How to resize an Image C#
- C# Dictionary get item by index
- A field initializer cannot reference the nonstatic field, method, or property