...

/

Generic Types

Generic Types

Learn about classes that accept type parameters.

Introduction

Consider the following Holder class:

public class Holder
{
    public string[] Items { get; private set; }

    public Holder(int holderSize)
    {
        Items = new string[holderSize];
    }

    public override string ToString()
    {
        string result = "Items inside: ";

        foreach (var item in Items)
        {
            result = result + item + " ";
       
...

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy