I create private method, with different input data, it works differently.
private void SetSelectedRouters(bool isSelected)
{
for (int i = 0; i < m_listPlatforms.Count; i++)
{
m_listPlatforms[i].IsCheked = isSelected;
}
}
And create public method for interaction.
public void SelectedAllRouters()
{
SetSelectedRouters(true);
}
public void SelectedNoneRouters()
{
SetSelectedRouters(false);
}
I think this is encapsulation, or as something in a different name?
This isn’t encapsulation. It’s an extracted method. All of the code in the method is relevant to one other and its purpose is clearly described in its name. This is also called a helper method.