【发布时间】:2017-12-18 10:43:38
【问题描述】:
如何使用单行 if 语句来减少此类编码的代码行数
if (string.IsNullOrEmpty(txtpictext.Text))
{
Cmd.Parameters.AddWithValue("@pictext", DBNull.Value);
}
else
{
Cmd.Parameters.AddWithValue("@pictext, txtpictext.Text);
}
Conn.Open();
Cmd.ExecuteNonQuery();
【问题讨论】:
-
所以你知道有一个"inline c# if",但是很难用还是什么?
-
stackoverflow.com/q/1678311/993547 的副本,还有很多很多。
标签: c# if-statement