list of object is updating its values on updating another object in Blazor

126 Views Asked by At

When I am updating my Some properties of my MstService Class Object, on the same time it is updating SList of type List Too,Don't know why??enter image description here

protected MstService Service { get; set; } = new MstService();
        public List<MstService> SList { get; set; } = new List<MstService>();        

        public async Task ResetForm()
        {
            Service.Id = 0;
            Service.Name = "";
            Service.IsActive = false;
            values.Clear();
            btnSubmitDisabled = false;
            btnAddRangeDisabled = false;
            btnRemoveDisabled = false;
            SList = (await serviceMater.GetServices()).ToList();
        }

Why the values are changing in SList enter image description here

enter image description here

0

There are 0 best solutions below