错误:无法将类型字符串隐式转换为字符串[] [英] Error : cannot implicitly convert type string to string[]

查看:90
本文介绍了错误:无法将类型字符串隐式转换为字符串[]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以给我一个示例.......如何在c#中将字符串转换为字符串[] .....

我有一条线......

 model.PostedCities.CityIDs =   0; 



在这个CityIDs中是字符串[] .......

解决方案

string []是一个数组(向量)字符串字符串只是一个字符串(一个列表/字符数组)



答案可能是:



 返回  new  [] {m​​odel.PostedCities.CityIDs} ; 


Can anyone give me a sample ....... how to convert string to string[] in c#.....
I am having a line ......

model.PostedCities.CityIDs = "0";


In this CityIDs is string[] .......

解决方案

string[] is an array (vector) of strings string is just a string (a list/array of characters)

The answer could be:

return new []{ model.PostedCities.CityIDs };


这篇关于错误:无法将类型字符串隐式转换为字符串[]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆