0

我对这段代码有疑问:

OAuthTokens tokens = new OAuthTokens();
tokens.AccessToken = "****";
tokens.AccessTokenSecret = "****";
tokens.ConsumerKey = "****";
tokens.ConsumerSecret = "****";

小程序(根据要求):

//cutted out default "using"'s
using Twitterizer;

namespace Mustache_Tweet_App
{
    public partial class Main : Form
    {
        // config
        OAuthTokens Tokens = new OAuthTokens();
        Tokens.AccessToken = "...";
        Tokens.AccessTokenSecret = "...";
        Tokens.ConsumerKey = "...";
        Tokens.ConsumerSecret = "...";
        Tokens.RequestToken = Twitterizer.OAuthUtility.GetRequestToken(Tokens.ConsumerKey, Tokens.ConsumerSecret, "");
        public Main()
        {
            InitializeComponent();
        }

        private void GetAuthKey_Click(object sender, EventArgs e)
        {
            String AuthUri = Twitterizer.OAuthUtility.BuildAuthorizationUri();
            System.Diagnostics.Process(AuthUri);
            MessageBox.Show("Please authorize and copy the key then click OK and paste it into the the key box.", "Info");
        } 
    }
}

错误:

****.Main.tokens' is a 'field' but is used like a 'type'
Invalid token '=' in class, struct, or interface member declaration

在所有“令牌”上获得相同的错误。

使用 Twitterizer 2-2-4。也使用 Visual Studio 2012。

4

1 回答 1

0

OAuthTokens对象没有属性RequestToken

并且OAuthTokens.ConsumerKeyandOAuthTokens.ConsumerSecret没有get访问器,因此您不能按照您的方式使用它们。

为什么你不想要请求令牌?您已经在Tokens对象中拥有它们。

于 2013-01-02T09:58:28.077 回答