Jump to content

[WPF C#] Operator '+' cannot be applied to operands of type 'string' and 'method


Recommended Posts

Boas eh... eu tenho este codigo

HttpWebRequest req = (HttpWebRequest) WebRequest.Create("http://whatismyip.com/automation/n09230945.asp");
                    HttpWebResponse res = (HttpWebResponse) req.GetResponse();
                    Stream Stream = res.GetResponseStream();
                    StreamReader sr = new StreamReader(Stream);                    
                    exIP.Content = "External IP: " + sr.ReadToEnd

e ele na parte "External IP: " + sr.ReadToEnd

dá-me este erro: Operator '+' cannot be applied to operands of type 'string' and 'method

alguma ideia como corrigir isto?

eu no vb.net usava assim

"External IP: " & sr.ReadToEnd

e como sou iniciante em C# usei um conversor de Vb.net para C# e da-me esse erro :S

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.