Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ListIndexer
- {
- string[] arr;
- public int Length;
- public ListIndexer(int Size)
- {
- arr = new string[Size];
- Length = Size;
- }
- public string this[int index]
- {
- set { arr[index] = value; }
- get { return arr[index]; }
- }
- }
- private void search_Click(object sender, EventArgs e)
- {
- var list = new ListIndexer(Size: lbCollection.Items.Count);
- for (int i = 0; i < list.Length; i++)
- {
- list[i] = lbCollection.Items[i].ToString();
- }
- MessageBox.Show("Элемент под индексом " + (Convert.ToInt32(index.Text)) + " = " + list[Convert.ToInt32(index.Text)].ToString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement