J
JSheble
I come from a Delphi background, and am currently trying to port or convert
some of our Delphi classes to C#. I've got a good handle on basic class
design, but am a bit lost with some of the more advanced things I need to
do, and was hoping somebody could point me to an online resource that can
help me better understand what I need to do.
For example, one of the classes is a Shipment class. A Shipment can have
any number of Packages, so I have designed a Shipment Class and a Package
class. I should be able to retrieve any of the packages by it's index or I
should be able to use a single package as a property. For example (these
examples are not working code, merely pseudo-code to demonstrate what I
need):
oShip = new Shipment();
oShip.AddPackage(sPackageID, dPackageWeight);
oShip.AddPackage(sDifferentPackageID, dPackageWeight);
// access the first package object in the shipment
MessageBox.Show(oShip.Packages[0].PackageID);
// loop though all packages
foreach(Package oPack in oShipment)
{
MessageBox.Show(oPack.PackageID);
}
Either a basic template that shows how I need to design my class or a good
online resource would be greatly appreciated!
TIA!
some of our Delphi classes to C#. I've got a good handle on basic class
design, but am a bit lost with some of the more advanced things I need to
do, and was hoping somebody could point me to an online resource that can
help me better understand what I need to do.
For example, one of the classes is a Shipment class. A Shipment can have
any number of Packages, so I have designed a Shipment Class and a Package
class. I should be able to retrieve any of the packages by it's index or I
should be able to use a single package as a property. For example (these
examples are not working code, merely pseudo-code to demonstrate what I
need):
oShip = new Shipment();
oShip.AddPackage(sPackageID, dPackageWeight);
oShip.AddPackage(sDifferentPackageID, dPackageWeight);
// access the first package object in the shipment
MessageBox.Show(oShip.Packages[0].PackageID);
// loop though all packages
foreach(Package oPack in oShipment)
{
MessageBox.Show(oPack.PackageID);
}
Either a basic template that shows how I need to design my class or a good
online resource would be greatly appreciated!
TIA!