2011-12-22 52 views
1

如何使用FormatVariant的數組?我有應存儲信息和參數分開,這樣翻譯可以在頂層做一個例外:具有變體數組的格式?

TMyException = class (Exception) 
private 
    FParams : array of Variant; 
public 
    constructor Create (const Msg : String); 
    constructor CreateFmt (const Msg : String; Args : array of Variant); 
end; 

現在,我怎麼在以後使用Format與存儲的值?

+1

你需要TVarRec而不是變體:http://rvelthuis.de/articles/articles-openarr.html – 2011-12-22 08:52:29

+0

@David:再次感謝!讓這個答案,我會接受它。 – jpfollenius 2011-12-22 09:55:31

回答

2

格式和類似使用的const數組實際上是作爲開放數組TVarRec實現的。雖然表面上與變體相似,但TVarRec是另一種不同的野獸。我建議Rudy Velthuis的優秀article解釋了複製和操作TVarRec數組所需的一些細節。

相關問題