本文介绍了将字符串分配给字符串数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个字符串分配给一个字符串数组。但编译器确实让我这样做



这是以下代码



string [] sSuccessCode;



sSuccessCode = row.EMPLOYEECODE;



请给我一些建议

i wanted to assign a string into a array of string.But the compiler does let me doing it

Here's the following code

string[] sSuccessCode;

sSuccessCode = row.EMPLOYEECODE;

please give me some suggestion

推荐答案

string[] sSuccessCode = new string[4];  //specify size
sSuccessCode[0] =row.EMPLOYEECODE;


string[] sSuccessCode;
        List<string> lstsSuccessCode = new List<string>();
        lstsSuccessCode.Add(row.EMPLOYEECODE);
        sSuccessCode = lstsSuccessCode.ToArray();


string[] sSuccessCode = new string[4];  //specify size
sSuccessCode[0] =row.EMPLOYEECODE;


这篇关于将字符串分配给字符串数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 13:55