我有以下類:我需要在我的類構造函數中設置初始值嗎?
public class Detail
{
public Detail()
{
this.File = String.Empty;
this.State = false;
this.Tag1 = 0
}
public string File { get; set; }
public bool State { get; set; }
public int Tag1 { get; set; }
}
}
我需要在構造函數中設置的初始值這樣或者將這些只是默認,當我創建的類。如何編程練習。即使不需要,在這裏設置它們會不會更好?