Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
Say i have ipaddress stored in string var=192.168.1.2 and i have to store it in URL as "tcp://var:8084/Class1" how could i accomplish this?How could i do this?plz answer this.
Posted
Comments
Sergey Alexandrovich Kryukov 12-Jul-15 2:28am    
Where did you get such a URL scheme, tcp? There is no such thing, is there? If it was there, how would it work?
Here is the list of registered scheme names: https://en.wikipedia.org/wiki/URI_scheme.
—SA

1 solution

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-
C#
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.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 12-Jul-15 2:28am    
Please see my comment to the question.
—SA
Suvendu Shekhar Giri 12-Jul-15 4:26am    
Apologies for messing up things. Completely missed it !
Thanks a lot @SA. As always it was a great help :)
Sergey Alexandrovich Kryukov 12-Jul-15 11:59am    
:-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900