c# - String Join not working fine -
following code returns true, why?
var inputs = new object[]{null, 1}; var output = string.join(",", inputs); console.writeline(output == "");//prints true
> output = ""
but following code working fine
var inputs = new object[]{"", null, 1}; var output = string.join(",", inputs); console.writeline(output == "");//prints false
> output = ",,1"
is wrong in native implementation?
from msdn:
if first element of values
null
,join(string, object[])
method not concatenate elements in values instead returnsstring.empty
.
which special case overload using object[]
. note isn't true other overloads, string[]
one.
Comments
Post a Comment