以下测试按书面要求通过。为什么?(即,为什么数组中的前导null值导致string.Join()返回空字符串?)[TestMethod]public void Test_string_Join(){ object[] values0 = { "foo", 3, null }; var text0 = string.Join(", ", values0); Console.WriteLine("text0 = " + text0); AssertX.AreEqual("foo, 3, ", text0); // works as expected object[] values1 = { null, "foo", 3, null }; var text1 = string.Join(", ", values1); Console.WriteLine("text1 = " + text1); AssertX.AreEqual("", text1); // does NOT work as expected, why empty?}
1 回答
- 1 回答
- 0 关注
- 394 浏览
添加回答
举报
0/150
提交
取消