Created
April 30, 2018 16:50
-
-
Save jaredcatkinson/7c4a0ff7052d214b2e2744035d34cf62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update-TypeData -TypeName Object -MemberType ScriptMethod -MemberName SizeOf -Value { | |
param() | |
if($this -is [type]) { | |
$SizeOf = [System.Runtime.InteropServices.Marshal].GetMethod('SizeOf',[type[]]@([type])) | |
} | |
else { | |
$SizeOf = [System.Runtime.InteropServices.Marshal].GetMethod('SizeOf',[type[]]@([Object])) | |
} | |
return $SizeOf.Invoke($null,@($this.psobject.BaseObject)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment