---
title: "More different items in one list"  
description: "More different items in one list"  
author: "marcel ethan"  
published: 2013-12-17  
updated: 2013-12-17  
canonical: https://www.mindstick.com/forum/1793/more-different-items-in-one-list  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# More different items in one list

I want to make a list with different [items](https://www.mindstick.com/forum/33812/getting-number-of-items-selected-in-uicollectionview-in-ios) or what I should call it. I [mean](https://yourviews.mindstick.com/view/80768/what-does-real-minority-mean) for example.

```
public class form1                                                                                                                                            {    public List<string> information = new List<string>();}And I want It to contain information from textboxes with Id, name and phonenumber like this:private void btnForm_Click(object sender, EventArgs e){    Form2 Form1= new Form2();    Form1.Show();    class Form2a = new Form2();    a.information.Add(txtId.Text);    a.information.Add(txtName.Text);    a.information.Add(txtPhonenumber.Text);}
```

Then it will be filled with what we can call different [customers](https://www.mindstick.com/articles/13008/how-does-a-customer-portal-enhance-the-experience-of-customers) who have different Id, names and phonenumbers.

Then I want to get the information to another form.

Can someone please help me or give me [tips](https://www.mindstick.com/articles/13091/12-tips-to-boost-your-studying-efficiency) on how?

## Replies

### Reply by Pravesh Singh

Hi Marcel,

You should group that information using a class then create and add instances of that class to your list. Below is an example class and some other code you may find helpful.

```
public class PersonInfo{     public string Name;     public string Id;     public string phoneNumber;}List<PersonInfo> persons = new List<PersonInfo>();// after reading valuespersons.Add(new PersonInfo(txtName.Text, txtId.Text, txtPhoneNumber.Text));// if you don't have a constructor like that defined;personse.Add(new PersonsInfo {                    Name = txtName.Text;                    Id = txtId.Text;                    PhoneNumber = txtPhoneNumber.Text;             });// get a user by IdPersonInfo p = persons.Where(x => x.Id == "that other Id").FirstOrDefault();if (p != null)   // we found our person
```


---

Original Source: https://www.mindstick.com/forum/1793/more-different-items-in-one-list

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
