As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center作为指导。
已关闭8年。
以前从未见过这样的事情。我正在做一个非常简单的DataReader值分配。
但是
为什么要删除
已关闭8年。
以前从未见过这样的事情。我正在做一个非常简单的DataReader值分配。
story.Byline = _r["Byline"].ToString();
但是
_r["Byline"].ToString()
和story.Byline
的值在分配后是不同的。这是立即窗口的输出:story.Byline
"Associated Press - FIRST LASTAssociated Press - FIRST LAST"
_r["Byline"].ToString()
"Associated Press - FIRST LAST<br />Associated Press - FIRST LAST"
为什么要删除
<br />
? 最佳答案
调用reader["x"].ToString()
实际上就是调用x'类型的可能被覆盖的方法ToString()
。
如果您确定它是字符串,请使用reader.GetString(reader.GetOrdinal("x"))