Hi,
Doing my first WPF project. I need to get an environment variable on startup, check if it is null and change it to a message if it is, and display it in a TextBox.
I am doing something wrong.
App.xaml.cs:
I get "Invalid token 'if' in class, struc or interface member declaration."
I need to put the string and the if into something else, right? But I cannot figure out what.
I know, this is really basic stuff, but there is quite a lot to wrap your head around here.
Doing my first WPF project. I need to get an environment variable on startup, check if it is null and change it to a message if it is, and display it in a TextBox.
I am doing something wrong.
App.xaml.cs:
Code:
namespace CleanDocTypes
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
//Get the environment variable
string configRootValue = Environment.GetEnvironmentVariable("ConfigRoot");
if (configRootValue == null)
{
configRootValue = "Environment variable not found";
}
}
}
I get "Invalid token 'if' in class, struc or interface member declaration."
I need to put the string and the if into something else, right? But I cannot figure out what.
I know, this is really basic stuff, but there is quite a lot to wrap your head around here.