Creating Custom Collection in C#

Introduction

Creating a User Defined Custom Collecting, with the Add() and the Tostring() method.

Background

Creating a User Defined Custom Collecting with the Add() and the Tostring() method.

Here, the Add() method will Add the String to the collection, such as given below:

Input

EX :

//creating object of own Created Collection

CustomCollection cust = new CustomCollection();

cust.Add("cibun");

cust.Add("swain");

cust.Add("Mona");

cust.Add("Routray");

And the Tostring() method will show the results, such as given below:

Output

Console.Write(cust.ToString());
Console.ReadLine();
'cibun,swain, Mona,Routray' 

Ebook Download
View all
Learn
View all