The only problem is the locality of definition: your declaration of
Name
is accessible only in its block's scope. If you didn't use curly brackets, even the declaration would cause compilation error. The resolution would look like
string name = null;
if (Selection)
name = "Hello";
else
name = "something else";
You need to read on locality and scope topics before moving any further. Nearly any C# manual would include this topic.
Good luck,
—SA