title: PSObject -Property with conditions
body: <p>I would like to put conditions in this part of my code:</p>
  
  <pre><code>$objInfos = New-Object PSObject -Property @{
                      Dossier = [string]"$($logs[0])"
                      "Taille totale" = [double]$logs[1]
                      "Categorie recherchee" = [double]$logs[2]
                      "Pourcentage" = [double]$logs[3]
                      "Date de dernier acces" = [DateTime]"$($logs[5])"
  }
  </code></pre>
  
  <p>I'd need every case to have conditions, like that:</p>
  
  <pre><code>$objInfos = New-Object PSObject -Property @{
                      if ($test -eq 1){
                          Dossier = [string]"$($logs[0])"
                      }
                      "Taille totale" = [double]$logs[1]
                      "Categorie recherchee" = [double]$logs[2]
                      "Pourcentage" = [double]$logs[3]
                      "Date de dernier acces" = [DateTime]"$($logs[5])"
  }
  </code></pre>
  
  <p>I tried this way and it didn't work</p>
  
  <blockquote>
    <p>Missing '=' operator after key in hash literal.</p>
  </blockquote>
  
  <p>Does someone know how to do please?</p>