דוגמה למחלקה מורכבת / טיפוס מורכב בשפת C#:

המחלקה Classroom היא אוסף של Student

public class Student{

private String name;

private String lName;

private String id;

public Student (String name, String lName, String id)

{

        this.name = name;

        this,lName = lName;

        this.id = id;

}

}

public class Classroom{

private Student [] students;

private int count;

public Student()

{

students = new Student[30];

count= 0;

}

public bool addStudent(Student s)

{

        if(s.Length =< count)

                return bool; //not enough space

        

        students[count] = s;

        count++;         

}

// print all names of Students

@override

public override string Tostring()

{

        string s = "";

        for(int i=0; i<count  ; i++)

        {

                s+="full name: "+ students[i].GetName() +" "+students[i].GetLName();+"\n";

        }

        return s;

}

}