c# - 错误 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);
}
}
解决方案
使用枚举HttpStatusCode
:
if (httpResponse2.StatusCode == HttpStatusCode.OK)
推荐阅读
- c# - 处置问题,我应该忽略 Visual Studio 警告吗?
- jquery - 在 jQuery 中使用 If Else
- c# - 将 html 应用程序转换为 C# 应用程序
- scala - 使用 Scala 泛型时出现意外的类型不匹配
- matlab - 为什么 MATLAB 两次绘制相同的东西,弄乱了一个新的情节?
- ruby-on-rails - 将列数据添加到“has_many through”关系
- python - 如何使用带有animation.FuncAnimation的matplotlib为png图像制作动画
- dart - 如何在颤动的listview.builder中的索引处设置小部件的状态
- ssis - SSIS:如何获取审计中更新和删除的行数?
- bash - 带有前置字符的 Bash if 语句