Forum Discussion

balubeto's avatar
balubeto
Brass Contributor
Nov 15, 2022

Displaying the properties of an variable

Hi

 

I created a variable of type String.

How do I display all of its properties?

 

Thanks

 

Bye

3 Replies

    • balubeto's avatar
      balubeto
      Brass Contributor

      LainRobertson 

       

      I noticed a peculiarity:

       

      Even if I write one of the above two instructions at the beginning of a script, its ouptut is only displayed at the end of that script. How come?

       

      Note: I am using Visual Studio Code as my IDE.

       

      Thanks

       

      Bye

      • LainRobertson's avatar
        LainRobertson
        Silver Contributor

        balubeto 

         

        That's quite common as the pipeline is written asynchronously to the output stream.

         

        You can generally force the issue using Out-Default but I wouldn't recommend doing this outside of test scenario (where I'd advocate for using other mechanics such as Write-Warning or Write-Verbose instead.)

         

        Example:

        Get-Member -InputObject $YourStringVariable | Out-Default;

         

        Cheers,

        Lain

Resources