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 returns string.empty.

which special case overload using object[]. note isn't true other overloads, string[] one.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -