Sets

Top  Previous  Next

What is translated > Types > Sets

 

A Delphi set is simulated in the C# VCL by the class TSet in DelphiSets.cs.

 

public class TSet : IEnumerable

 

Every TSet consists of 256 bits, which can be set or unset.

 

 

var

CharSet: set Of 'a'..'z';

NumberSet: set Of 1..10;

 

->

 

private static TSet CharSet = new TSet();

private static TSet NumberSet = new TSet();

 

 

 

A set is created on the fly, if there is no explicit type-declaration of a set, as e.g. in:

 

MySet := ['a','b','c'];

 

->

 

MySet = new TSet() << 'a' << 'b' << 'c';

 

An example of a set constant is:

 

 

type

  TDay = (dMon, dTue, dWed, dThu, dFri, dSat, dSun);

 

const

  cDays: set Of TDay = [dMon .. dSun];

 

 

-> 

 

public enum TDay {dMon,

           dTue,

           dWed,

           dThu,

           dFri,

           dSat,

           dSun };

 

public static TSet cDays = TSet() << 

          (int) dMon << (int) dTue << (int) dWed << (int) dThu << (int) dFri << (int) dSat << 

          (int) dSun;

 

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content