procedure TForm1.Button1Click(Sender: TObject);
type
TmySetof = Set of (so0=0, so1, so2, so3, so4, so5, so6, so7, so8, so9, so10);
var
aSetof, anotherSetof: TmySetof;
iResult: integer;
sDebug: string;
function SetofToInt(const aSetOf; const iSize: integer): integer;
begin
result:= 0;
Move(aSetOf, result, iSize);
end;
procedure InToSetof(const aValue: integer; var aSetOf; const iSize: integer);
begin
Move(aValue, aSetOf, iSize);
end;
begin
aSetof:= [so0, so1, so9];
iResult:= SetofToInt(aSetof, SizeOf(aSetof));
ShowMessage('iResult=' + IntToStr(iResult));
// for me, it displays 515;
// now, test if the above hard-coded displayed result is ok:
InToSetof(515, anotherSetof, SizeOf(aSetof));
sDebug:= '';
if anotherSetof * [so0] <> [] then sDebug:= sDebug+',so0';
if anotherSetof * [so1] <> [] then sDebug:= sDebug+',so1';
if anotherSetof * [so2] <> [] then sDebug:= sDebug+',so2';
if anotherSetof * [so3] <> [] then sDebug:= sDebug+',so3';
if anotherSetof * [so4] <> [] then sDebug:= sDebug+',so4';
if anotherSetof * [so5] <> [] then sDebug:= sDebug+',so5';
if anotherSetof * [so6] <> [] then sDebug:= sDebug+',so6';
if anotherSetof * [so7] <> [] then sDebug:= sDebug+',so7';
if anotherSetof * [so8] <> [] then sDebug:= sDebug+',so8';
if anotherSetof * [so9] <> [] then sDebug:= sDebug+',so9';
if anotherSetof * [so10] <> [] then sDebug:= sDebug+',so10';
ShowMessage('[setOf]=' + sDebug);
end;