private void ValidateCredentials()
{
bool userNameEmpty = String.IsNullOrEmpty(UserName);
bool passwordEmpty = String.IsNullOrEmpty(Password);
if (userNameEmpty ^ passwordEmpty)
{
// If only one of them is set, throw.
throw new CommandLineException(NuGetResources.SourcesCommandCredentialsRequired);
}
}