tags:

views:

33

answers:

1

What's the best object layout in ASP.net or at least.. what are the advantages and disadvantages of either case:

    Public Class Dog
        Public Breed as String
        Public Type as String
        Etc....

OR the use of properties and keeping variables private

Somewhat of a debate among our team about it. Just wanted to hear thoughts.

+2  A: 

Never expose fields directly.

Use properties with private backing fields. This allows you to change implementation and to encapsulate logic around getting/setting them.

See what the Visual Basic Team have to say on this.

Also, read about the differences between fields and properties.

Oded
Thanks for this... good stuff.
jlrolin