集合类型的变量怎么写入ini文件

集合类型的变量如何写入ini文件?
集合类型的变量如何写入ini文件?大家有没有好办法?

------解决方案--------------------
集合要看集合的长度,
1.如果位数<=32位,用Integer代替,
2.如果>32,可以考虑用流来处理,
也可以考虑先转换成字符串,再转换成可见字符然后保存,读的时候逆向,分别给出代码,
Delphi(Pascal) code

//<=32位的情况
Type
  TMyType  = (mtA1,mtA2,mtA3,mtA4,mtA5); //这样定义只有5位,因此可以用整数保存
  TMyTypes = Set of TMyType;
  PMyTypes = ^TMyTypes;

procedure SaveIt(Ini : TIniFile; MyTypes : TMyTypes);
var
  n : integer;
begin
  n := 0;  //高位清0
  PMyTypes(@n)^ := MyTypes;
  Ini.WriteInteger('Root' , 'MyTypes' , n);
end;

Function ReadIt(Ini : TIniFile) : TMyTypes;
var
  n : integer;
begin
  n := Ini.ReadInteger('Root' , 'MyTypes' , 0);
  Result := PMyTypes(@n)^;
end;

//>32位时
Type
  TMyType  = 0..100; //这样定义有101位,需要用Bin存储
  TMyTypes = Set of TMyType;
  PMyTypes = ^TMyTypes;


procedure SaveIt(Ini : TIniFile; MyTypes : TMyTypes);
var
  MS : TMemoryStream;
begin
  MS := TMemoryStream.Create;
  MS.SetSize(SizeOf(TMyTypes));
  MS.WriteBuffer(MyTypes , SizeOf(TMyTypes));
  MS.Position := 0;
  Ini.WriteBinaryStream('Root', 'MyTypes' , MS);
  MS.Free;
end;

Function ReadIt(Ini : TIniFile) : TMyTypes;
var
  MS : TMemoryStream;
begin
  MS := TMemoryStream.Create;
  MS.SetSize(SizeOf(TMyTypes));
  MS.Position := 0;
  Ini.ReadBinaryStream('Root', 'MyTypes' , MS);
  MS.Position := 0;
  MS.Read(Result , SizeOf(TMyTypes));
  MS.Free;
end;