Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Delphi Cookbook
  • Table Of Contents Toc
Delphi Cookbook

Delphi Cookbook

By : Daniele Teti
4.5 (19)
close
close
Delphi Cookbook

Delphi Cookbook

4.5 (19)
By: Daniele Teti

Overview of this book

Intended to refresh the basics of Delphi as well as advance your knowledge to the next level, it is assumed you will know RAD studio and the Object Pascal language. However, if you are not an experienced RAD studio programmer this accessible guide will still develop those initial crucial skills.
Table of Contents (9 chapters)
close
close
8
Index

Writing enumerable types

When the for..in loop was introduced in Delphi 2005, the concept of enumerable types was also introduced into the Delphi language.

As you know, there are some built-in enumerable types. However, you can create your own enumerable types using a very simple pattern.

To make your container enumerable, implement a single method called GetEnumerator, that must return a reference to an object, interface, or record, that implements the following three methods and one property (in the sample, the element to enumerate is TFoo):

function GetCurrent: TFoo;
function MoveNext: Boolean;
property Current: TFoo read GetCurrent;

There are a lot of samples related to standard enumerable types, so in this recipe you'll look at some not-so-common utilizations.

Getting ready

In this recipe, you'll see a file enumerable function as it exists in other, mostly dynamic, languages. The goal is to enumerate all the rows in a text file without actual opening, reading and closing the file...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Delphi Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon