binary Converter using Get Set
<p>Am making a Binary converter in a windows form using Get and Set method</p>

<p>Code to carry out the conversion</p>

<pre><code>class SubnetConvert
{
private int numconvert;
private string OctetToBinary;

public int OctetConvert
{
get 
{
    return numconvert;
}
    set
    {
        List&lt;int&gt; Subnet = new List&lt;int&gt;(new int[] { 128, 64, 32, 16, 8, 4, 2, 1 });
        foreach (int num in Subnet)
        {
            if (num &lt;= numconvert)
            {
                numconvert -= num;
                OctetToBinary += "1";
            }
            else
            {
                OctetToBinary += "0";
            }
        }
    }
}
public string SendBinary
{
    set
    {
        OctetToBinary = value;
    }
    get
    {
        return OctetToBinary;
    }
}
</code></pre>

<p>Code applied to the Convert button</p>

<pre><code> private void btnSubnetting_Click(object sender, EventArgs e)
    {
        SubnetConvert SubnetOctet = new SubnetConvert();
        lblOctet1.Text = "";
        int Octet1 = int.Parse(txtOctet1.Text);
        SubnetOctet.OctetConvert = Octet1;
        lblOctet1.Text = SubnetOctet.SendBinary;
    }
</code></pre>

<p>At the moment the only value returned is either 8 0s or 8 1s</p>
