Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 357 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Member type in PowerShell (ScriptProperty, Property, and NoteProperty)

#1
What are the member types in PowerShell, like ScriptProperty, Property, Method, NoteProperty, Alias, and EventProperty?

For example, `CPU` is ScriptProperty. How can we classify it as ScriptProperty?

I would like brief information about all of them.

Reply

#2
There used to be a great introduction on MSDN to the *PowerShell Extended Type System* (unfortunately lost with the changes since PSH v1).

Essentially PowerShell allows an underlying .NET object to be wrapped with additional members via the [PSObject][1] type. This can be done in a number of ways:

- Using `Add-Member` (giving maximum control)
- Specifying additional properties by passing a hash rather than a name to `Select-Object`'s property parameter
- Using `New-Object` to create a `PSObject` and passing
- In .NET code (C#, VB, …) using the underlying `PSObject` properties and [`PSMemberInfo`][2] sub-types.

The different types of "extended" member are represented by those `PSMemberInfo` sub-types, including:

- NoteProperty: a .NET object or value.
- AliasProperty: an alias for another property (eg. a collection could have both a Count and a Length property with one being another name for the other).
- ScriptProperty: a property with get and set methods written in PowerShell.
- CodeProperty: a property with get and set methods written in C#, VB, ….

and so forth.


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#3
See the [PSMemberTypes Enumeration page][1]


[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through