Are the PowerShell modules the closer "thing" of classes in C#? -
this continuation of previous question:
how create real objects behavior (methods) in powershell?
i think i'm able encapsulate behavior in classes still think approach hacky, , address problem the powershell way
so, powershell modules appear answer...
i know if illustration want encapsulate behavior in object oriented way in powershell best option/approach?
are powershell modules designed purpose?
edit 01
in other words how guys write scripts?
do go writing them in procedural way
or...
is there cleaner way apply object oriented programming concepts when writing powershell scripts?
dont know if best method, why not utilize pscustomobject?
$o=new-object -typename pscustomobject -property @{"val"="test"} add-member -inputobject $o -membertype scriptmethod -name upper -value {$this.val.toupper()} $o.upper() test
or maybe you'll find happyness project on codeplex : http://psclass.codeplex.com/
c# powershell powershell-v2.0 powershell-v3.0
No comments:
Post a Comment