Skip to content

Instantly share code, notes, and snippets.

@breezhang
Last active August 3, 2022 20:20
Show Gist options
  • Save breezhang/4641849 to your computer and use it in GitHub Desktop.
Save breezhang/4641849 to your computer and use it in GitHub Desktop.
Powershell Generic Collections powershell v3
New-Object System.Collections.ObjectModel.Collection["string"]
# from msdn
#[SerializableAttribute]
#[ComVisibleAttribute(false)]
#public class Collection<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
#
$o=1|Select Nom, DureeDeVie,Numero
$DefaultProperties =@('Nom','DureeDeVie')
$DefaultPropertySet=New System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet',[string[]]$DefaultProperties)
$PSStandardMembers=[System.Management.Automation.PSMemberInfo[]]@($DefaultPropertySet)
$o|Add-Member MemberSet PSStandardMembers $PSStandardMembers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment