开发者

Unable to build code I copied from an article

开发者 https://www.devze.com 2023-02-04 07:01 出处:网络
I have this code that I copied from Mike Bluestein\'s article on sending e-mail from an app. Unfortunately, I get the foll开发者_Python百科owing error on line 5:

I have this code that I copied from Mike Bluestein's article on sending e-mail from an app. Unfortunately, I get the foll开发者_Python百科owing error on line 5:

Unexpected symbol 'public' 

What am I missing?


You copied it into a method. The code you copied defines a member variable at a class level and then a couple methods.

It looks to be just a sample taken out of a larger codebase, so even if you just paste it into a class, it probably still won't work as you expect (if at all). Instead of blindly copy/pasting you want to read through the article and the example to understand what it's doing and then replicate it in your own code.

I second Konrad's suggestion: you may want to brush up on C# first.


I added a link to the sample project at the bottom of the blog post. I hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消