Nel

Nel

  • NA
  • 716
  • 1.1m

The name hufT doesn't exist in the current context

Nov 22 2014 10:03 PM

Hi,

I have  a console application and these methods

 static DataTable GethufT()
        {
            // Here we create a DataTable with four columns.
            DataTable hufT = new DataTable();

            hufT.Columns.Add("Difference DX", typeof(int));
            hufT.Columns.Add("Code", typeof(String));

            hufT.Rows.Add(0, "1");
            hufT.Rows.Add(1, "00");
            hufT.Rows.Add(-1, "011");
            hufT.Rows.Add(2, "0100");
            hufT.Rows.Add(-2, "01011");
            hufT.Rows.Add(3, "010100");
            hufT.Rows.Add(-3, "0101011");
            hufT.Rows.Add(4, "01010100");
            hufT.Rows.Add(-4, "010101011");
            hufT.Rows.Add(5, "010101010");
            hufT.Rows.Add(-5, "01010101011");
            hufT.Rows.Add(6, "010101010100");
            hufT.Rows.Add(-6, "0101010101011");
            //   hufT.Rows.Add(88, "01011000");  //dali smeam???

            return hufT;

        }

 public static void huffman(int number, out string code)
        {
           GethufT();
            string h = "";
            foreach (DataRow row in hufT.Rows)
            {
                if (number == 88)
                { h = "01011000"; }
                else if (number.ToString() == row["Difference DX"].ToString())
                {
                    h = row["Code"].ToString();
                    break;
                }
            }
            // MessageBox.Show(number.ToString() + "huf" + "h" + h);
            code = h;
        }

But I get this error

The name hufT doesn't exist in the current context

CAn anybody help me please why and how to solve it?

Thanks


Answers (2)