A
Andy B.
I have the following objects layed out in code. I keep them simple here for
sake of the list (the actual objects are around 300 lines of code each).
'Define an address object.
namespace Events
private class Address
'Fields
dim Street as string
dim Line2 as string
dim City as string
dim State as TeritoryCode
dim Country as CountryCode
dim ZipCode as string
'Properties for the above fields. Since the address object is nothing more
than a container for data, the property definitions are skipped here to make
things simple.
'Constructers
Address(...)
end function
end class
'Define a Venue
private class Venue
'Fields
private Name as string
Private Address as Address
private Type as string
'Properties for above fields.
public property Name() as string
get
return Name
end get
set(ByVal Value as string)
Name = Value
end set
end property
public property Address() as Address
get
return Address
end get
set(ByVal Value as Address)
Address=Value
End set
end property
public property Type() as string
get
return Type
end get
set(ByVal Value as string)
Type = value
end set
end property
end class
end namespace
What I want to know, is how do you access the Address property values in the
Venue.Address property. I'm thinking something like:
dim Venue1 as new Venue()
dim AddressForVenue1 as new Address()
AddressForVenue1.Street="123 StreetName"
AddressForVenue1.Line2=string.empty
AddressForVenue1.City="Detroit"
AddressForVenue1.State = TerritoryCode.MI
AddressForVenue1.Country = CountryCode.USA
AddressForVenue1.ZipCode = "12345"
Venue1.Address = AddressForVenue1
'Or can I do it this way instead?
Venue1.Address.Street = "123 StreetName"
Venue1.Address.Line2 = string.empty
Venue1.Address.City="Detroit"
'... and so on?
What way is better and more practicle to do?
sake of the list (the actual objects are around 300 lines of code each).
'Define an address object.
namespace Events
private class Address
'Fields
dim Street as string
dim Line2 as string
dim City as string
dim State as TeritoryCode
dim Country as CountryCode
dim ZipCode as string
'Properties for the above fields. Since the address object is nothing more
than a container for data, the property definitions are skipped here to make
things simple.
'Constructers
Address(...)
end function
end class
'Define a Venue
private class Venue
'Fields
private Name as string
Private Address as Address
private Type as string
'Properties for above fields.
public property Name() as string
get
return Name
end get
set(ByVal Value as string)
Name = Value
end set
end property
public property Address() as Address
get
return Address
end get
set(ByVal Value as Address)
Address=Value
End set
end property
public property Type() as string
get
return Type
end get
set(ByVal Value as string)
Type = value
end set
end property
end class
end namespace
What I want to know, is how do you access the Address property values in the
Venue.Address property. I'm thinking something like:
dim Venue1 as new Venue()
dim AddressForVenue1 as new Address()
AddressForVenue1.Street="123 StreetName"
AddressForVenue1.Line2=string.empty
AddressForVenue1.City="Detroit"
AddressForVenue1.State = TerritoryCode.MI
AddressForVenue1.Country = CountryCode.USA
AddressForVenue1.ZipCode = "12345"
Venue1.Address = AddressForVenue1
'Or can I do it this way instead?
Venue1.Address.Street = "123 StreetName"
Venue1.Address.Line2 = string.empty
Venue1.Address.City="Detroit"
'... and so on?
What way is better and more practicle to do?