You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.usingSystem;usingSystem.ComponentModel.Composition;usingMicrosoft.VisualStudio.ProjectSystem.Utilities;namespaceMicrosoft.VisualStudio.ProjectSystem.VS{[Export(typeof(IProjectSystemOptions))]internalclassEnvironmentVariableProjectSystemOptions:IProjectSystemOptions{privatereadonlyIEnvironmentHelper_environment;[ImportingConstructor]publicEnvironmentVariableProjectSystemOptions(IEnvironmentHelperenvironment){Requires.NotNull(environment,nameof(environment));_environment=environment;}publicboolIsProjectOutputPaneEnabled{get{
#if DEBUGreturntrue;
#else
returnIsEnabled("PROJECTSYSTEM_PROJECTOUTPUTPANEENABLED");
#endif
}}privateboolIsEnabled(stringvariable){stringvalue=_environment.GetEnvironmentVariable(variable);returnstring.Equals(value,"1",StringComparison.OrdinalIgnoreCase);}}}
Use expression body for accessors:
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.usingSystem;usingSystem.ComponentModel.Composition;usingMicrosoft.VisualStudio.ProjectSystem.Utilities;namespaceMicrosoft.VisualStudio.ProjectSystem.VS{[Export(typeof(IProjectSystemOptions))]internalclassEnvironmentVariableProjectSystemOptions:IProjectSystemOptions{privatereadonlyIEnvironmentHelper_environment;[ImportingConstructor]publicEnvironmentVariableProjectSystemOptions(IEnvironmentHelperenvironment){Requires.NotNull(environment,nameof(environment));_environment=environment;}publicboolIsProjectOutputPaneEnabled{get=>true;
#else
returnIsEnabled("PROJECTSYSTEM_PROJECTOUTPUTPANEENABLED");
#endif
}privateboolIsEnabled(stringvariable){stringvalue=_environment.GetEnvironmentVariable(variable);returnstring.Equals(value,"1",StringComparison.OrdinalIgnoreCase);}}}}
Use expression body for properties:
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.usingSystem;usingSystem.ComponentModel.Composition;usingMicrosoft.VisualStudio.ProjectSystem.Utilities;namespaceMicrosoft.VisualStudio.ProjectSystem.VS{[Export(typeof(IProjectSystemOptions))]internalclassEnvironmentVariableProjectSystemOptions:IProjectSystemOptions{privatereadonlyIEnvironmentHelper_environment;[ImportingConstructor]publicEnvironmentVariableProjectSystemOptions(IEnvironmentHelperenvironment){Requires.NotNull(environment,nameof(environment));_environment=environment;}publicboolIsProjectOutputPaneEnabled=>true;
#else
returnIsEnabled("PROJECTSYSTEM_PROJECTOUTPUTPANEENABLED");
#endif
privateboolIsEnabled(stringvariable){stringvalue=_environment.GetEnvironmentVariable(variable);returnstring.Equals(value,"1",StringComparison.OrdinalIgnoreCase);}}}
The text was updated successfully, but these errors were encountered:
davkean
changed the title
"Use expression body for accessors/properties" generates bad code for #if
"Use expression body for accessors/properties" generates bad code if body contains #if
May 4, 2017
Use expression body for accessors:
Use expression body for properties:
The text was updated successfully, but these errors were encountered: