- Aug
- 2,033
- 82
Code:
c:\users\jlc\documents\vb.net>ver
TCC 22.00.38 x64 Windows 7 [Version 6.1.7601]
A simple class example;
Code:
' File: Add.vb
Public Class AddClass
Public Shared Function Add(ByVal i As Long, ByVal j As Long) As Long
Return i + j
End Function
End Class
Starting in a brand-new TCC;
Code:
c:\users\jlc\documents\vb.net>pshell /s "[AddClass] | get-member -static"
PSHELL: System.Management.Automation.RuntimeException : Unable to find type [AddClass].
This is as it should be, since I have not yet added the class definition.
Code:
c:\users\jlc\documents\vb.net>pshell /s "add-type -Path %_cwd\add.vb"
Class has been added. Now, let's see what's in the class;
Code:
c:\users\jlc\documents\vb.net>pshell /s "[AddClass] | get-member -static"
TypeName: AddClass
Name MemberType Definition
---- ---------- ----------
Add Method static long Add(long i, long j)
Equals Method static bool Equals(System.Object objA, System.Object objB)
new Method AddClass new()
ReferenceEquals Method static bool ReferenceEquals(System.Object objA, System.Object objB)
Again, this is as it should be. Now, close the persistent PowerShell interpreter;
Code:
c:\users\jlc\documents\vb.net>pshell /c
The class should no longer be available to me;
Code:
c:\users\jlc\documents\vb.net>pshell /s "[AddClass] | get-member -static"
TypeName: AddClass
Name MemberType Definition
---- ---------- ----------
Add Method static long Add(long i, long j)
Equals Method static bool Equals(System.Object objA, System.Object objB)
new Method AddClass new()
ReferenceEquals Method static bool ReferenceEquals(System.Object objA, System.Object objB)
...but it still is.
Is this WAD? I was hoping that doing PSHELL /C would remove the class that I added.
Joe
Last edited: