is there any C# method that works similar to Convert.ToBase64String but doesn't generate anything except alphanumeric output?
Thanks!
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
Quote from wikipedia: "A successor to the programming language B, C was originally developed at Bell Labs by Dennis Ritchie between 1972 and 1973 to construct utilities running on Unix." The creators want that everyone "see" his language. So he named it "C".
C is a high-level and general-purpose programming language that is ideal for developing firmware or portable applications. Originally intended for writing system software, C was developed at Bell Labs by Dennis Ritchie for the Unix Operating System in the early 1970s.
The answers are a bit outdated now. For the benefit of future searchers: The best way to handle this now in C# is:
byte[] b; // fill your byte array somehow
string s = System.Web.HttpServerUtility.UrlTokenEncode(b);
This returns a Base64-encoded string that is URL-safe (which is what you said you were really after in the comments to your question).
You can then decode it again using, you guessed it:
byte[] b = System.Web.HttpServerUtility.UrlTokenDecode(s);
You're probably looking at using something like Base32 encoding then. There is a Base32 encoder/decoder for C# here by Michael Giagnocavo. It uses a combination of capitalized letters and numbers.
There's also a related discussion on StackOverflow here.
EDIT: And if by any chance this is for URL-safe related Base64 encoding, just do Base64 and replace "+" with "-" and "/" with "_". But I'm guessing, you may not want it for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With