Материал из .Net Framework эксперт
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Understanding Automatic Properties
Automatic properties provide you with a shorthand method for defining a new property.
You can"t add any logic to the Getters and Setters for an automatic property.
You can"t create read-only automatic properties.
File: App_Code\AutomaticProperties.cs
public class AutomaticProperties
{
// Automatic Properties
public int Id { get; set; }
public string Description { get; set; }
// Normal Property
private decimal _Price;
public decimal Price
{
get { return _Price; }
set { _Price = value; }
}
}