asp.net编译提示__o变量不存在错误

在aspx页面文件中用if或者for逻辑运算代码

csharp 复制代码
     <%foreach (string file in pics){ %>
       <div class="swiper-slide"><img src="pic/<%=file%>" alt=""></div>
     <%} %>

编译器则会提示以下错误

据说是编译器生成的临时变量,编译器会报错,但运行没有任何问题。

如果看到这些错误提示很烦,可以在Code Behind代码中增加已给__o变量

csharp 复制代码
public partial class Default : System.Web.UI.Page
{
  public string __o = "";
  // ...
}
相关推荐
helx8215 分钟前
SpringBoot中自定义Starter
java·spring boot·后端
rleS IONS1 小时前
SpringBoot获取bean的几种方式
java·spring boot·后端
lifewange1 小时前
Go语言-开源编程语言
开发语言·后端·golang
白毛大侠1 小时前
深入理解 Go:用户态和内核态
开发语言·后端·golang
王码码20352 小时前
Go语言中的数据库操作:从sqlx到ORM
后端·golang·go·接口
星辰_mya3 小时前
雪花算法和时区的关系
数据库·后端·面试·架构师
计算机学姐4 小时前
基于SpringBoot的兴趣家教平台系统
java·spring boot·后端·spring·信息可视化·tomcat·intellij-idea
總鑽風4 小时前
单点登录springcloud+mysql
后端·spring·spring cloud
0xDevNull4 小时前
Java 11 新特性概览与实战教程
java·开发语言·后端
bearpping5 小时前
Spring Boot + Vue 全栈开发实战指南
vue.js·spring boot·后端