In a c# initialiser, I want to not set a property if a condition is false.
Something like this:
ServerConnection serverConnection = new ServerConnect
I suspect this would work, but using logic this way sort of defeats the purpose of using the initializer.
ServerConnection serverConnection = new ServerConnection()
{
ServerInstance = server,
LoginSecure = windowsAuthentication,
Login = windowsAuthentication ? null : user,
Password = windowsAuthentication ? null :password
};