Anybody please?

2009/7/29 Dmitiry Nagirnyak <[email protected]>

> Hi,
>
> I would like to use code like this for my lookup classes:
>
> if (address.Country == Countries.Australia)
> {
>   // Do something
> }
>
> Here the Countries class is defined like this:
> public class Countries
> {
>   public Country Austrlia
>   {
>     get
>     {
>       return ObtainLokupFromDB("Australia");
>       // OR
>       return new Country
>       {
>           Id = 14,
>           Code = "Australia",
>           Description = "Australia"
>       }
>     }
> }
>
> But I am not sure hot to implement this.
> On one hand I don't want to go to the database as I know all the values
> even at compile time.
> But if I'll create a Country instance it won't allow me to use "=="
> operator to compare teh values (so I need to override Equals and
> GetHashCode).
>
> What are your suggestions on this?
>
> Cheers,
> Dmitriy.
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to