I think I outsmarted myself this time. Feel free to edit the title also I could not think of a good one.
I am reading from a file and then in that file will be a string
The line
if (typeof(T) is string)
will always return false sine the typeof operator gives a Type object. You should replace it with
if (T is string)
In addition you should look at the Convert.ChangeType method. It may be of help here.