Compress To String - CSharp System.Xml

CSharp examples for System.Xml:XML String

Description

Compress To String

Demo Code


using System.Text;
using System.IO.Compression;
using System.IO;/*from w  ww .j  av  a2  s.c o  m*/
using System;

public class Main{
        public static byte[] CompressToString(string decompressedData, Encoding encoding = null)
      {
         encoding = encoding ?? Encoding.UTF8;
         var textBytes = encoding.GetBytes(decompressedData);
         return Compress(textBytes);
      }
}

Related Tutorials