I would second the previous responsives and provide
a simple real world advantage to using properties.
Being able to tell which classes have at least one
property that has changed can allow you to skip
records in bulk loads that don't need to be processed.
Can definitely improve performance.
private string _isDirty = false;
private string _myProperty = String.Empty;
public string MyProperty
{
string valueTrimmed = "";
get
{
return _myProperty;
}
set
{
valueTrimmed = value.Trim();
if (_myProperty != valueTrimmed)
{
_myProperty = valueTrimmed;
_isDirty = true;
}
}
}
public bool IsDirty
{
get { return _isDirty; }
set { _isDirty = value; }
}
--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp