This is how I am getting my encoded string in a textblock :.
BitArray encoded = huffmanTree.Encode(input);
foreach (bool bit in encoded)
{
tb2.Text += ((bit ? 1 : 0) + "");
}
Now, How should I create and save this encoded string in a compressed binary file?