R
Ray Porter
Guest
Hi,
I'm in the process of converting an old Delphi Windows program to WinForms/C#. The Delphi application relies heavily on a custom class that includes several TStringList objects as properties (pretty similar to a C# string collection). I've built a c# class that mirrors the old object pascal class, replacing the TStringList objects with StringCollections. In the Delphi code, the constructor for the class has a number of statements to instantiate the string objects (myStringList := TStringList.Create) while the destructor has the corresponding Free statements. In my c# code, I've tried to replicate that process. The string collection objects are declared as private then exposed as public properties with getters and setters. I can walk through the code in the debugger and see the string collections instantiated properly in the constructor but when I try and use them in an instance of the class, I'm getting a null reference exception. All the basic data type properties work as expected. What am I missing?
Continue reading...
I'm in the process of converting an old Delphi Windows program to WinForms/C#. The Delphi application relies heavily on a custom class that includes several TStringList objects as properties (pretty similar to a C# string collection). I've built a c# class that mirrors the old object pascal class, replacing the TStringList objects with StringCollections. In the Delphi code, the constructor for the class has a number of statements to instantiate the string objects (myStringList := TStringList.Create) while the destructor has the corresponding Free statements. In my c# code, I've tried to replicate that process. The string collection objects are declared as private then exposed as public properties with getters and setters. I can walk through the code in the debugger and see the string collections instantiated properly in the constructor but when I try and use them in an instance of the class, I'm getting a null reference exception. All the basic data type properties work as expected. What am I missing?
Continue reading...