I am new to C#. In one of projects, I came across this code to compress and decompress a text:
//Compressing:
using System.IO;
using System;
using System.IO.Compression;
using System.Text;
public class Program
{
public static void Main(string[] args)
{
string plainText = "shantha";
byte[] buffer = Encoding.UTF8.GetBytes(plainText);
var memoryStream = new MemoryStream();
using (var gZipStream = new GZipStream(memoryStream, CompressionMode.Compress, true))
{
gZipStream.Write(buffer, 0, buffer.Length);