In CodeFixProvider I need to remove wrapping if-condition (for example):
if (temp == null)
{
temp = new Temp();
}
and I want to leave only adjusted inner expression:
// I want to change the inner expression as well
temp = anotherTemp()
As soon as I attempt to replace nodes of 'if-block' with line-line statement, 'unable to cast' exception is thrown. Do you know proper way to do it?