O'Reilly logo

C# Data Structures and Algorithms by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example – book reader

As an example, you will prepare a simple application that allows a user to read a book by changing the pages. One should be able to move to the next page (if it exists) after pressing the N key, and go back to the previous page (if it exists) after pressing the P key. The content of the current page, together with the page number, should be shown in the console, as presented in the following screenshot:

Let's start with the declaration of the Page class, as shown in the following code:

public class Page 
{ 
    public string Content { get; set; } 
} 

This class represents a single page and contains the Content property. You ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required