public partial class Form1 : Form
{
string[] names = new string [20]
{"John","Susy","Obedia","Saul","Abram","Lincoln","Abraham","Eli","Kain","Abel",
"Will","Smitty","Scott","Julie","Ramona","Melissa","Todd","Lilly","Naomi","Leland"};
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//Question #1 Pop Names in listbox
for (int i = 0; i < names.Length; i++)
{
listBox1.Items.Add(names[i]);
}
}
这就是我填充我的方式listbox1
,但现在listbox2
我想显示每个名称的长度。我想知道如何在 C# 代码中找到它?