首页 > 解决方案 > 错误 CS0019 运算符“==”不能应用于“HttpStatusCode”和“int”类型的操作数

问题描述

您好,我正在尝试编译我制作的程序,但遇到了一个我不知道如何修复的错误。我已经尝试了我能想出的所有解决方案,并想看看是否有人可以帮助我修复它这是发生错误的代码。

string text4 = string.Format("X-XSRF-TOKEN={0}&X-XSRF-URI=%2Flogin%2FdoLauncherLogin&fromForm=yes&authType=&linkExtAuth=&epic_username={1}&password={2}&rememberMe=YES", attributeValue, arg, arg2);
httpRequest.Cookies = httpResponse.Cookies;
xNet.HttpResponse httpResponse2 = httpRequest.Post("", text4, "application/x-www-form-urlencoded; charset=UTF-8");
if (httpResponse2.StatusCode == 200)
{
    ref int ptr = ref this.int_0;
    this.int_0 = ptr + 1;
    ptr = ref this.int_2;
    this.int_2 = ptr + 1;
    backgroundWorker.ReportProgress(0, text);
    if (this.bool_0)
    {
          this.queue_1.Enqueue(text2);
    }
}

标签: c#compilation

解决方案


使用枚举HttpStatusCode

if (httpResponse2.StatusCode == HttpStatusCode.OK)

推荐阅读