samedi 7 novembre 2020

Is is good practice to have same type of list in a class?

I have created a class and I'm putting a list of same type as a property of that class. Is it good or bad practice?

I am putting the same type of list because of I want to manage everything by only one object. I don't want to create a single object and a list of object of the same type.

Any help is highly appreciated !!!

class AssetSection
{
    public string Code { get; set; }
    public string Description { get; set; }
    public string SITEID { get; set; }
    public string PlantID { get; set; }
    public string User { get; set; }
    public string UpDateTime { get; set; }

    public List<AssetSection> AssetSections { get; set; }

    public AssetSection(string des, string code)
    {
        Description = des;
        Code = code;
    }
}

Aucun commentaire:

Enregistrer un commentaire