Looking at some c# code from open and closed source project i see that private, and sometimes public methods are designed to recive parameters and not directly access the instance variable to extract the parameter they need
class A
{
private B b;
public void Methode1()
{
Methode2(b.SomeProperty);
}
private void Methode2(string param)
{
}
}
Is this considered as a good practice, or it’s just a programming way?
Yes, its normal. Consider also moving
Methode2to classB(Tell, don’t ask principle):What is bad – passing whole object as parameter for method, when you need only value of it’s property (don’t pass to method more, than it needs for execution):