How to add members to a PSObject in C#? How to add members to a PSObject in C#? powershell powershell

How to add members to a PSObject in C#?


PSMemberInfo is a abstract class, so you cannot make an instance directly, but choose its subclass

in the page : http://msdn.microsoft.com/en-us/library/system.management.automation.pspropertyinfo(v=vs.85).aspx you can find below:

System.Object    System.Management.Automation.PSMemberInfo    System.Management.Automation.PSPropertyInfo       System.Management.Automation.PSAliasProperty       System.Management.Automation.PSCodeProperty       System.Management.Automation.PSNoteProperty       System.Management.Automation.PSProperty       System.Management.Automation.PSScriptProperty

Choose your class, and init it.