串和記錄的是這樣的事情可能與德爾福? (帶有動態數組的字符串和記錄)恆就地陣列中的德爾福
type
TStringArray = array of String;
TRecArray = array of TMyRecord;
procedure DoSomethingWithStrings(Strings : TStringArray);
procedure DoSomethingWithRecords(Records : TRecArray);
function BuildRecord(const Value : String) : TMyRecord;
DoSomethingWithStrings(['hello', 'world']);
DoSomethingWithRecords([BuildRecord('hello'), BuildRecord('world')]);
我知道它不能像那樣編譯。只是想問一下是否有一個竅門可以得到類似的東西。
要知道,寫'程序DoSomethingWithStrings(字符串:TStringArray);'將在棧上創建'TStringArray'參數的臨時副本。你最好添加一個'const'這裏,即寫'程序DoSomethingWithStrings(常量字符串:TStringArray);' – 2011-06-07 13:06:52