while (null != (strLine = sr.ReadLine())) 中第二个等号是什么含义

bizbuy 2004-05-08 01:26:19
如题,第二个等号在VB中相当于什么?

上面是C#语法
...全文
306 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
李欣欣1981 2004-05-08
  • 打赏
  • 举报
回复
其实就是先从sr读一行进来,赋值给strLine,然后判断strLine是不是为null,在不等于null的时候循环
vb的话:
strLine = sr.ReadLine()
do while (strLine != null )
......
loop
eastfiat 2004-05-08
  • 打赏
  • 举报
回复
少了一句
strLine = sr.ReadLine();
while (null != strLine)
{
strBuilder.Append(strLine+"<br>");
strLine = sr.ReadLine();
}
eastfiat 2004-05-08
  • 打赏
  • 举报
回复
等于
strLine = sr.ReadLine();
while (null != strLine)
{
strBuilder.Append(strLine+"<br>");
}
bizbuy 2004-05-08
  • 打赏
  • 举报
回复
他的整个语法是:

while (null != (strLine = sr.ReadLine()))
{
strBuilder.Append(strLine+"<br>");
}

我想知道如何把这句换成VB
brightheroes 2004-05-08
  • 打赏
  • 举报
回复
while (null != (strLine = sr.ReadLine()))


最好改成如下
while(sr.Peek() != -1)
{
strLine = sr.ReadLine();
////
}
气象短息发布平台,适合地市级气象局使用 private void timer1_Tick(object sender, EventArgs e) { // DateTime now = DateTime.Now; DateTime t = DateTime.Now; DateTime zhengdian = new DateTime(t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second); DateTime shijian = new DateTime(t.Year, t.Month, t.Day, 15, 50, 0); // DateTime shijian1 = new DateTime(t.Year, t.Month, t.Day); if (shijian == zhengdian) { StreamReader sr = new StreamReader("d:\\forecast\\dq1", System.Text.Encoding.Default); string chr1, chr2, fx1, fx2, fs1, fs2; string wea, wind, wins, tqxx; int tmax, tmin; string[] tq = new string[32] { "晴", "多云", "阴", "阵雨", "雷阵雨", "雷阵雨夹雪", "雨夹雪", "小雨", "雨", "大雨", "暴雨", "大暴雨", "特大暴雨", "阵雪", "小雪", "雪", "大雪", "暴雪", "雾", "冻雨", "沙尘暴", "小到雨", "到大雨", "大到暴雨", "暴雨到大暴雨", "大暴雨到特大暴雨", "小到雪", "到大雪", "大到暴雪", "浮尘", "扬沙", "强沙尘暴" }; string[] st = new string[7] { "拉萨", "日喀则", "那曲", "林芝", "泽当", "狮泉河", "昌都" }; string[] stnum = new string[7] { "55591", "55578", "55299", "56312", "55598", "55228", "56137" }; string[] fx = new string[10] { "", "东北风", "东风", "东南风", "南风", "西南风", "西风", "西北风", "北风", "旋转不定风" }; string[] fs = new string[10] { "", "3~4级", "4~5级", "5~6级", "6~7级", "7~8级", "8~9级", "9~10级", "10~11级", "11~12级" }; string strline = sr.ReadLine(); int i = 0, c, w1, w2; SqlConnection con5 = bc1.getcon(); con5.Open(); int rn = bc1.getrecnum("select count(*)from ybdata"); SqlCommand cmd5 = new SqlCommand(); string sqlins; while (strline != null) { chr1 = strline.Substring(0, 5); if (chr1 == stnum[i]) { chr1 = strline.Substring(6, 5); w1 = Convert.ToInt32(chr1) / 100; w2 = Convert.ToInt32(chr1) % 100; if (w1 == w2) { wea = tq[w1]; } else { wea = tq[w1] + "转" + tq[w2]; } chr1 = strline.Substring(12, 5); c = Convert.ToInt32(chr1) - 10000; if (c == 0) { wind = ""; wins = ""; } else { chr2 = c.ToString(); fx1 = fx[Convert.ToInt32(chr2.Substring(0, 1))]; fx2 = fx[Convert.ToInt32(chr2.Substring(1, 1))]; fs1 = fs[Convert.ToInt32(chr2.Substring(2, 1))]; fs2 = fs[Convert.ToInt32(chr2.Substring(3, 1))]; if (fx1 == fx2) { wind = fx1; } else { wind = fx1 + "转" + fx2; } if (fs1 == fs2) { wins = fs1; } else { wins = fs1 + "转" + fs2; } } chr1 = strline.Substring(18, 5); tmin = (Convert.ToInt32(chr1) - 20000) / 100; tmax = (Convert.ToInt32(chr1) - 20000) % 100; if (tmin >= 50) { tmin = 0 - (tmin - 50); } if (tmax >= 50) { tmax = 0 - (tmax - 50); } if (wind == "") { tqxx = "便民气象站:" + st[i] + "今晚到明天" + wea + ",气温" + tmin + "到" + tmax + "度。"; } else { tqxx = "便民气象站:" + st[i] + "今晚到明天" + wea + "," + wind + wins + ",气温" + tmin + "到" + tmax + "度。"; } rn = rn + 1; sqlins = "insert into ybdata (id,diming,yubao,time) values('" + rn + "','" + st[i] + "','" + tqxx + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "')"; cmd5.CommandText = sqlins; cmd5.Connection = con5; cmd5.ExecuteNonQuery(); } strline = sr.ReadLine(); i = i + 1; if (i > 6) { break; } } // MessageBox.Show("预报文件已生成!"); con5.Close(); sr.Close(); }

62,242

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧