I'm studying some open source codes and converting them from visual studio version 2017 to 2015.
But I don't know how to convert any code.
I think there is a problem with the declaration of local variables in conditional statement.
This code
public static void ManageToolActivation(this IMachineElementViewModel vm, bool value)
{
if (vm is ToolHolderViewModel thvm)
{
thvm.ActiveTool = value;
}
else
{
foreach (var item in vm.Children)
{
var child = item as MachineElementViewModel;
child.ManageToolActivation(value);
}
}
}
causes
The name 'thvm' does not exist in the current context
ToolHolderViewModel
is a name of other project(class).
It works in visual studio 2017 but not in visual studio 2015. I think there's a problem with declaring variables in conditional statements.
How can I modify this code to work?