Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Removed overkill calls to Select-Object -ExpandProperty #412

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

softwarepronto
Copy link
Contributor

@softwarepronto softwarepronto commented Sep 1, 2023

The script uses the . operator to access properties ($Secret.StartDateTime) except here:

$RemainingDaysCount = $EndDate - $Now |
Select-Object -ExpandProperty Days

It is simpler to write
$RemainingDaysCount = ($EndDate - $Now).Days

Description

Simplified and made code cleaner by removing Select-Object -ExpandPropert

Checklist

  • This pull request was tested on both of:
  • Scripts do not contain static passwords or other secret tokens.
  • All Azure resource identifiers which must be universally unique are guaranteed to be so.

Testing information

Platform and PowerShell version: [pscustomobject]$PSVersionTable | Select-Object OS, BuildVersion, PSVersion

Az version: (Get-InstalledModule -Name Az).Version

The script uses the . operator to access properties ($Secret.StartDateTime) except here:

$RemainingDaysCount = $EndDate - $Now |
            Select-Object -ExpandProperty Days

It is simpler to write
$RemainingDaysCount = ($EndDate - $Now).Days
@softwarepronto
Copy link
Contributor Author

Make the code cleaner

Copy link
Contributor

@mikefrobbins mikefrobbins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mikefrobbins mikefrobbins merged commit 691d626 into Azure:master Sep 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants