I have a couple questions about the short code sample below (making a Function out of the recently posted GUID example).
1. Should any objects be dropped to clean up? Not sure if these fancy new dotnet objects need to be dropped.
2. Am I correct that the objectClrOption statement should only be done once per program execution? (and is therefore outside of the function)
Thanks!
-Kirby
objectClrOption( 'use', 'System.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' )
#definefunction GetGUID()
; Construct a guid using any random guid as a constructor parameter.
strGuid = "{D28AC658-2D3C-4111-B297-1E7D132F2FE4}"
oGUID = ObjectClrNew('System.Guid',strGuid )
; Returns a VT_RECORD and WinBatch does not have built in functionality
; to handle this variant type directly.
rGUID = oGUID.NewGuid() ; Returns a vt_record
; However, ObjectClrType can turn it into a regular COM/CLR object
; with a little help from the FCL.
strctGuid = ObjectClrType("System.Guid", rGUID)
sGuid = strctGuid.ToString()
return sGuid
#endfunction
for i = 1 to 10
Message("String Representation of New Guid", GetGUID())
next i