I have this function in my application that I need to simplify in order to improve the code quality:void FilterValues()    {        List<SecondaryStockRoomDefenition> GridViewItems = new List<SecondaryStockRoomDefenition>();        GridViewItems = StockRooms.ToList();        if (cboPrimaryStockRoom.SelectedValue.ToString().Trim() != 0)        {            GridViewItems =           StockRooms.Where((SecondaryStockRoomDefenition, index)               => GridViewItems[index].DeletedSecondaryStockRoom == false                  && GridViewItems[index].PrimaryStockroomCode == cboPrimaryStockRoom.SelectedValue.ToString().Trim()).ToList();        }        if( txtSecondaryStockRoomCode.Text !=  )        {            GridViewItems = GridViewItems.Where((SecondaryStockRoomDefenition,index) =>                 GridViewItems[index].DeletedSecondaryStockRoom == false                && GridViewItems[index].SecondaryStockroomCode == txtSecondaryStockRoomCode.Text.Trim()).ToList();        }        if (txtSecondaryStockRoomName.Text != )        {            GridViewItems = GridViewItems.Where((SecondaryStockRoomDefenition, index) =>                GridViewItems[index].DeletedSecondaryStockRoom == false                && GridViewItems[index].SecondaryStockroomDescription.Contains(txtSecondaryStockRoomName.Text.Trim())).ToList();        }        if (txtStockRoomLocationCode.Text != )        {            GridViewItems = GridViewItems.Where((SecondaryStockRoomDefenition, index) =>                GridViewItems[index].DeletedSecondaryStockRoom == false                && GridViewItems[index].SecondaryStockroomLocationCode == txtStockRoomLocationCode.Text.Trim()).ToList();        }        if (cboStockRoomCategory.SelectedValue.ToString().Trim() != 0)        {            GridViewItems = GridViewItems.Where((SecondaryStockRoomDefenition, index) =>                GridViewItems[index].DeletedSecondaryStockRoom == false                && GridViewItems[index].SecondaryStockroomCategory == cboStockRoomCategory.SelectedValue.ToString().Trim()).ToList();        }        if (txtStockRoomType.Text != )        {            GridViewItems = GridViewItems.Where((SecondaryStockRoomDefenition, index) =>                GridViewItems[index].DeletedSecondaryStockRoom == false                && GridViewItems[index].SecondaryStockroomType == txtStockRoomType.Text.Trim()).ToList();        }        if (cboExpectedUserName.SelectedValue.ToString().Trim() != 0)        {            GridViewItems = GridViewItems.Where((SecondaryStockRoomDefenition, index) =>                GridViewItems[index].DeletedSecondaryStockRoom == false                && GridViewItems[index].ExpectedUserNameForCommissionEntry == cboExpectedUserName.SelectedValue.ToString().Trim()).ToList();        }        dgvCompanyProfileDetails.DataSource = null;        dgvCompanyProfileDetails.Rows.Clear();        dgvCompanyProfileDetails.DataSource = GridViewItems;    }
Filtering values for GridViewItems
c#