Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7792407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:10:30+00:00 2026-06-01T22:10:30+00:00

According to MSDN : Parameters must be declared on public non-static fields or properties.

  • 0

According to MSDN:

“Parameters must be declared on public non-static fields or
properties. Parameters should be declared on properties. The property
must have a public set accessor, and if the ValueFromPipeline or
ValueFromPipelineByPropertyName keyword is specified, the property
must have a public get accessor.”

Why do I have to declare get accessors in my cmdlet ValueFromPipeline parameters? As far as I know, PowerShell only needs to put their values in, not read them out. Thanks (by the way im just curious about this behavior 🙂 ).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:10:31+00:00Added an answer on June 1, 2026 at 10:10 pm

    PowerShell reads the default value of the parameters marked with ValueFromPipeline or ValueFromPipelineByPropertyName to make a backup before assigning the new value obtained from the pipeline.

    Consider the following cmdlets:

    New-Post -Title <string>
    Set-Post -InputObject <Post> -Title <string>
    

    where the following applies:

    • the New-Post cmdlet returns the newly created Post object to the pipeline, which has a Title property
    • the InputObject property on the Set-Post cmdlet is marked with ValueFromPipeline = true
    • the Title property on the Set-Post cmdlet is marked with ValueFromPipelineByPropertyName = true.

    Combining them with the following command:

    New-Post -Title "Foo" | Set-Post
    

    and setting a breakpoint on the get accessor of the Set-Post cmdlet’s Title property results in the following stack trace:

    Stack trace for parameter binding in PowerShell

    As you can see, the CmdletParameterBinderController.GetDefaultParameterValue method is invoked during the process of binding the Title property on the Set-Postcmdlet with the value from the corresponding property on the object coming from the pipeline.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to MSDN , a hash function must have the following properties: If two
According to [MSDN: Array usage guidelines]( http://msdn.microsoft.com/en-us/library/k2604h5s(VS.71).aspx) : Array Valued Properties You should use
According to MSDN , [The pipe name] must have the following form: \\.\pipe\pipename The
HttpResponse.End() seems to throw an exception according to msdn. Right now i have the
According to MSDN in .Net DateTimeFormat.MonthName should contain exactly 13 elements with 12 element
According to msdn it should be in windbase.h but it is not available instead
According to MSDN on DateTime.ToString ToString(s) should always return string in the format of
According to MSDN , Excel permits setting the Values property of a chart series
According to msdn Enums cannot have a base type of char. Why can enums
According to MSDN , the MaxConnections parameter means: The NetTcpBinding.MaxConnections property controls the maximum

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.