determining the right T for T.TryParse while reading a stream
<p>I have a method that Inputs a text file from passed string, have to check whether the passed type's TryParse is OK with read strings from stream, and then adds items to passed combobox</p>

<p>I tried to do this but stuck at how to pass the type and then check TryParse.</p>

<pre><code>private void Input(string file, ComboBox cb, /* object passedType */)
        {
            if (File.Exists(c + "recent_IPs.txt"))
            {
                FileStream stream = new FileStream(c + "recent_IPs.txt", FileMode.Open);
                StreamReader reader = new StreamReader(stream);

                while (!reader.EndOfStream)
                {
                    string read = reader.ReadLine();
                    /* passedType t; */
                    if (/* passedType.TryParse(read, out t) */)
                    {
                        cb.Items.Add(read);
                    }
                }

                reader.Close();
                stream.Close();

                if (cb.Items.Count &gt; 0)
                {
                    cb.SelectedIndex = 0;
                }
            }
        }
</code></pre>

<p>EDIT: By the way the "c" in</p>

<pre><code>...
if (File.Exists(c + "recent_IPs.txt"))
...
</code></pre>

<p>is </p>

<pre><code>string c = Directory.GetCurrentDirectory();
</code></pre>
