In C#, if I hide away implementation behind a facade, or the "pimpl" pattern, does the compiler optimize away the intermediate function call if all it's doing is calling an equivalent method from another class with the same parameters?
This is with dynamically created classes.
For example:
class A
{
internal bool Process(float value)
{
if (value > 0.5f)
{
return true;
}
return false;
}
}
class B
{
private A m_A = new A();
internal bool Process(float value)
{
return m_A.Process(value);
}
}
There's a chance the compiler might be able to replace calls to B.Process with A.Process.
Ignore the content of the classes. They're overly simplified to make a concise example.