基本類别範本
# Define a class
class TypeName
{
# Property with validate set
[ValidateSet("val1", "Val2")]
[string] $P1
# Static property
static [hashtable] $P2
# Hidden property does not show as result of Get-Member
hidden [int] $P3
# Constructor
TypeName ([string] $s)
{
$this.P1 = $s
}
# Static method
static [void] MemberMethod1([hashtable] $h)
{
[TypeName]::P2 = $h
}
# Instance method
[int] MemberMethod2([int] $i)
{
$this.P3 = $i
return $this.P3
}
}