Click here to Skip to main content
15,031,361 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Java
String s = "D//log.txt";
java.net.URL url = new java.net.URL(s);


I want to convert above code to C#.
Please anybody help me conversion of above code in C#.
I have problem to converting second line java.net.URL in C#

Regards,
Ravi
Posted
Updated 17-May-11 1:17am
v2

try the following code

Url objUrl = new Url(s);
   
v2
Comments
senguptaamlan 17-May-11 7:49am
   
@Ramalinga : whats the point of making another persons answer wrong...it you are not confident enough....don't edit the solution....

The code should be the previous one that I've already written

Uri objUri = new Uri(s);
arindamrudra 17-May-11 8:02am
   
Amlan da you are correct. O kete dea Url koreche, ota vul. Uri correct (System.Uri).
arindamrudra 17-May-11 8:00am
   
@Ramalinga you are wrong Uri is the correct one not url(Url), check the msdn, System.Uri and please dont edit the correct answer and make it wrong.
arindamrudra 17-May-11 8:01am
   
Uri objUri = new Uri(s); Url is wrong here.
Manas Bhardwaj 17-May-11 11:32am
   
have +5. It would be better if you rollback to your version :)
Sergey Alexandrovich Kryukov 17-May-11 18:27pm
   
Agree, my 5.
--SA
Microsoft has provided a tool called Java Language Conversion Assistant (JLCA). This tool directly converts your Java programs to it's equivalent C# programs. You can find more information at : http://msdn.microsoft.com/vstudio/java/migrate/jlca/default.aspx
Hope this helps you !
   
Comments
yesotaso 17-May-11 16:32pm
   
Link is dead, though the name JLCA points right direction :)

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