更新时间:2023-11-15 17:53:40
well ,除了不知道你想要什么的问题,因为你的问题标题使用'数组',但你的代码使用'list',我现在假设'list' - 怎么样
someList.add(someTextBox.Text);
?
(这假设您已声明someList,SomeTextBox是表单上的有效TextBox)
well, apart from the issue of not knowing exactly what you want, since your question title uses 'array', yet your code uses 'list', I'll assume 'list' for now - how about
someList.add(someTextBox.Text);
?
(this assumes you have declared someList and SomeTextBox is a valid TextBox on your form)
假设您要添加对于字符串或整数列表的某些值,请检查:
Assuming that you want to add some value to a list of string or int, check this:
List<int> intList = new List<int>
intList.Add(1);
intList.Add(100);
List<string> stringList = new List<string>
stringList.Add("new string");
stringList.Add("other string");
如需了解更多信息,请参阅:列表(T)类(System.Collections.Generic) [ ^ ]
谢谢你回答我的问题。我很抱歉我错了deklare我的问题。我的意思是,如果我从文本框中添加字符串,那么c#可以做,然后字符串将写入代码。
例如:
thank you for answer my question.i am sorry i was wrong to deklare my problem.i mean Does c# can do if i adding string from textbox then the string will be write in a code.
example:
mylist.Add(new string[] {""});
当我从文本框输入banana并且我clik保存它将自动添加或更新代码。
it bec这样的话。
when i type "banana" from textbox and i clik save it will add or update automaticly from the code.
it become like this.
mylist.Add(new string[] {"banana"});
谢谢somuch。
thank you somuch.