locked
system.string value RRS feed

  • Question

  • If I execute GM on a system.string object  I don't see a property with its actual value. Am I missing something ?
    Wednesday, January 30, 2019 4:00 PM

All replies

  • I see what you mean, although the ToString() method retrieves the value assigned. Otherwise, the object with no property or method is the value assigned.

    $Str = [system.string]"This is a test"
    "Value: $Str"
    


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Wednesday, January 30, 2019 4:44 PM
  • If I'm not mistaken, the get/set methods are implied for the value in the class. In C# the value is an "Auto Property", or "Auto Implementation Property". The compiler creates the necessary code to get/set the value.

    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)


    Wednesday, January 30, 2019 4:52 PM
  • If I execute GM on a system.string object  I don't see a property with its actual value. Am I missing something ?

    Get-Member does not return values.  It just returns the properties and methods of  the "Type". 

    'string here' | Get-Member -MemberType Property

    'string here' | Get-Member -Static


    \_(ツ)_/

    Wednesday, January 30, 2019 5:17 PM