Reputation: 1191
If you a have Person Property on Address defined like
public class Address
{
public int AdressId {get; set;}
public Person AddressesPerson {get;set;}
public string FullAddress {get; set;}
}
What is the proper conventions, if any, for naming a property of another type?
Upvotes: 0
Views: 180
Reputation: 8190
Pick one and stick with it.
In your specific case, I wonder why a person is subordinate to an Address, instead of the other way around, but basically just pick the one you want to use and keep using it. As long as it's not something completely unreadable or against some kind of Team coding guidelines, you're probably good.
Upvotes: 0
Reputation: 14851
I don't think there's a hard and fast rule, but generally I like to stick to the following guidelines as much as possible:
Owner
might be an appropriate property name, since a Person
owns a particular Address
.Upvotes: 2
Reputation: 1027
I would name the property from the relationship between the two types, e.g. Resident, Owner etc.
Upvotes: 0
Reputation: 1500525
Name the property according to its semantic meaning. Frankly it's quite odd to have a Person property on an address - it would normally be the other way round. What's the meaning of the person here? What's the association between the address and the person? You might have Owner
or Resident
, for example - but in other cases that wouldn't be appropriate.
Upvotes: 2