How do I compress/decompress a string in VB.NET ?
I am trying to send long string through the Network and need them to be as small as possible before sending.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use GzipStream.
Here is an example:
edit 2 years later…
That didn’t quite work for me, perhaps because I needed to store the data in a byte array. This worked for Compress:
Then for Decompress I just passed the byte array into the constructor of mem2 instead of mem.ToArray.