c# - Error message: cannot convert from 'System.Collections.Generic.IEnumerable' to 'string[]' -
i have following c# source: (asp.net version:3.5)
//map 'string' type map = string.join("", trackmap.split('|').select(x => string.format("<a href=\"{0}\" class=\"lightview\"><img src=\"{0}\" style=\"margin-right:30px;\" width=\"120\" height=\"80\"/>gh</a>", x))); the problem error message:
argument '2': cannot convert 'system.collections.generic.ienumerable' 'string[]'
and error message:
the best overloaded method match 'string.join(string, string[])' has invalid arguments
my qustion how can fix it? (maybe add code in web.config file? add 'using'-someting?)
since in .net 3.5 has not yet supported join<t>(string, ienumerable<t>), supports join(string, object[]), so, need call toarray method in order convert ienumerable array:
map = string.join("", trackmap.split('|').select(x => string.format("...", x)) .toarray());
Comments
Post a Comment