Update:
Please ignore this solution . The question itself was not clear. I apologise for messing up the things.
First of all, rename your string variable to something else than 'var' because in C# it has a different meaning. Also need to keep the value within a pair of quotes.
You may do something like-
string myIp="192.168.1.2";
string tempUri=@"tcp://"+myIp+@":8084/Class1";
Uri myUri=new Uri(tempUri);
Hope, it helps :)
If your requirement is something else then please let me know.