I'm trying to store a set inside the object property (and read it) of a TStringList (I will also use it to store text associated to the set) but I get a invalid typecast for the set.
What's the best way to store a set inside a StringList object? Also, will this object need to be freed when destroying the StringList?
Here's some example code:
type
 TDummy = (dOne, dTwo, dThree);
 TDummySet = set of TDummy;
var
  DummySet: TDummySet;
  SL: TStringList;
begin
  SL := TStringList.Create;
  Try
    DummySet := [dOne, dThree];
    SL.AddObject('some string', TObject(DummySet)); // Doesn't work. Invalid typecast
  Finally
    SL.Free;
  End;
end;