Home How do I get a consistent byte representation of strings in C# without manually specifying an encoding?
Reply: 0

How do I get a consistent byte representation of strings in C# without manually specifying an encoding?

user455
1#
user455 Published in April 24, 2018, 8:37 am

How do I convert a string to a byte[] in .NET (C#) without manually specifying a specific encoding?

I'm going to encrypt the string. I can encrypt it without converting, but I'd still like to know why encoding comes to play here.

Also, why should encoding be taken into consideration? Can't I simply get what bytes the string has been stored in? Why is there a dependency on character encodings?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.451732 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO