---
title: "How to store multiple types of data in C# using the collection?"  
description: "How to store multiple types of data in C# using the collection?"  
author: "Ethan Karla"  
published: 2021-08-26  
canonical: https://answers.mindstick.com/qa/93933/how-to-store-multiple-types-of-data-in-c-sharp-using-the-collection  
category: "programming"  
tags: ["c#", "java"]  
reading_time: 1 minute  

---

# How to store multiple types of data in C# using the collection?

How to [store](https://www.mindstick.com/articles/12473/claue-best-magento-theme-for-online-fashion-store-portfolio-personal-blog) [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) types of [data in C#](https://www.mindstick.com/forum/30/read-xml-file-data-in-c-sharp) using the [collection](https://www.mindstick.com/articles/1718/collections-in-java)? using [array](https://www.mindstick.com/interview/34412/how-to-use-numpy-joining-array) list in [C# programming](https://www.mindstick.com/forum/156714/what-is-a-sealed-class-in-c-sharp-programming-and-why-do-we-use-this-class-in-opps).

## Answers

### Answer by Ravi Vishwakarma

Yes, we can store multiple types of [data](https://www.mindstick.com/articles/23186/how-becoming-a-data-analyst-can-be-a-lucrative-career) in C# using the collection. System.Collections namespace provides this feature to store multiple types of data in C#. This namespace has some classes to provide this feature.

1. ArrayList
2. Stack
3. Queue
4. Hashtable

**Example**

```
using System;
using System.Collections;
public class Program
{
 public static void Main()
 {
  ArrayList list=new ArrayList();
  list.Add(45);
  list.Add('Ram');
  list.Add('M');
  list.Add(15.23);
  list.Add(Convert.ToByte(12));
  foreach(var item in list)
  Console.WriteLine('Item : '+item+' Type : '+item.GetType().Name);
 }
}
```

## Output

```
Item : 45 Type : Int32
Item : Ram Type : String
Item : M Type : Char
Item : 15.23 Type : Double
Item : 12 Type : Byte
```


---

Original Source: https://answers.mindstick.com/qa/93933/how-to-store-multiple-types-of-data-in-c-sharp-using-the-collection

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
