CREATE NETOBJECT Example
Example 1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTime.ToString GIVING S$CMDLIN | |
|
|
|
|
|
|
DISPLAY |
"DATETIME:",*LL,S$CMDLIN,*W10 |
Example 2:
|
|
|
|
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
. |
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
.The FileModeXXXX NETOBJECTs are created from a FileMode Enumeration. | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
. |
|
|
|
|
|
|
|
. |
|
|
|
|
|
|
|
|
|
|
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
.Serialization Function | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
. Create a hashtable of values that will eventually be serialized. | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
| |
|
|
| |
|
* |
| |
|
.To serialize the hashtable (and its key/value pairs), you must first open . a stream for writing. | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
.Construct a SoapFormatter and use it to serialize the data to the stream. | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
.The data from the Addresses Hashtable is streamed into the FS file stream . in a SOAP format. | ||
|
. |
|
|
|
|
| |
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
.Deserialize Function | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
.Declare a hash table reference. | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
.Open the file containing the data that you want to deserialize. | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
.Construct a SoapFormatter and use it to deserialize the data. | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
.Deserialize the Hashtable from the file and assign the reference to the local variable. | ||
|
. |
|
|
|
|
| |
|
|
|
|
|
* |
|
|
|
.To prove that the table deserialized correctly, display the key/value . pairs to the Main Window. | ||
|
. |
|
|
|
|
|
|
|
|
|
|
|
. |
|
|
|
|
| |
|
. |
|
|
|
|
|
|
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
. |
|
|
|
|
|
|
|
|
|
|
|
. |
|
|
|
|
|
|
|
. |
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
. |
|
|
|
|
|
|
This program was derived from a sample program demonstrated by the Microsoft MSDN documentation for the 'SoapFormatter Class'. It demonstrates the following basic operations using NETOBJECT:
Creates .NET Enumerator Constants.
Creates .NET Hashtable object.
Creates .NET FileStream objects.
Creates .NET SOAP formatter object.
Executes .NET SOAP serializer to create a SOAP message that contains the Hashtable object data.
Executed .NET SOAP deserializer to retrieve Hashtable data from a SOAP message.
Demonstrates logic that can process throw the members of an IDictionaryEnumerator that iterates through the Hashtable data pairs.
![]() |