Insert value from pipeline to declare .NET class

Welcome Forums General PowerShell Q&A Insert value from pipeline to declare .NET class

Viewing 4 reply threads
  • Author
    Posts
    • #194723
      Participant
      Topics: 13
      Replies: 15
      Points: 85
      Rank: Member

      Is there is way to use a value from the pipeline to declare a .NET Class? this is what I tried, but it’s not working:

      Edit: Corrected .Net class being used.

    • #194762
      Moderator
      Topics: 5
      Replies: 237
      Points: 1,321
      Helping Hand
      Rank: Community Hero

      Hello,

      What is the requirement, and context?

      Thank you.

    • #194807
      Participant
      Topics: 13
      Replies: 15
      Points: 85
      Rank: Member

      It’s to let me know what values are in each property. It’s so I don’t need to look at the Microsoft doc and I have it ready at a moment’s notice.

    • #194819
      Moderator
      Topics: 5
      Replies: 237
      Points: 1,321
      Helping Hand
      Rank: Community Hero

      I am not sure though, but you can get the properties of a given .Net class using the `Get-Member` CmdLet…

      • #194822
        Moderator
        Topics: 5
        Replies: 237
        Points: 1,321
        Helping Hand
        Rank: Community Hero

        Also if .Net class is a type enum, then you can get the values using GetEnumNames() method

        For example

    • #194843
      Participant
      Topics: 13
      Replies: 15
      Points: 85
      Rank: Member

      I was able to figure this out:

       

Viewing 4 reply threads
  • The topic ‘Insert value from pipeline to declare .NET class’ is closed to new replies.