5

I am new to C#, csla and NHibernate. This might be a novice question but I didn't see a clear explanation elsewhere. Can someone please help me in understanding what is the difference between

   public int Property
    {
        get { return GetProperty<int>(Property); }
        private set { SetProperty<int>(Property, value); }
    }

and

public int Property{get;set;}
Tharif
  • 13,794
  • 9
  • 55
  • 77
user2990315
  • 271
  • 1
  • 5
  • 11

2 Answers2

2

CSLA implements a powerful new way of implementing properties, where you don't need to declare a field to store the property's value. The field values are managed by CSLA .NET and so are called managed fields. In the future some advanced features of CSLA .NET may be unavailable unless you use managed fields.

Syntax :

public string Name
{
  get { return GetProperty<string>(NameProperty); }
  set { SetProperty<string>(NameProperty, value); }
}

CSLA also supports a different syntax where you use private fields to store the values. This technique is faster than using managed fields, but requires that you declare and maintain your own fields.

Hope this gives a clear idea about the GetProperty and SetProperty

Wiktor Zychla
  • 47,367
  • 6
  • 74
  • 106
Tharif
  • 13,794
  • 9
  • 55
  • 77
0

GetProperty and SetProperty check the business rules for the property.

ARs
  • 466
  • 1
  • 7
  • 14