Your company uses Visual Studio .NET as its application development platform. You are creating an application that uses SOAP to exchange data with other applications using the .NET Framework. You use a user defined class named SoapEx that inherits from the ArrayList class to send objects to another application. You need to ensure that the application serializes the user defined class object for transport by using SOAP. Which of the following code segments will you use to accomplish the required task?

Options
- SoapFormatter formatter = new SoapFormatter(); MemoryStream mstream = new MemoryStream(); formatter.Serialize(mstream, SoapEx);
- SoapFormatter formatter = new SoapFormatter(); byte[] buf = new byte[SoapEx.Capacity]; MemoryStream mstream = new MemoryStream(buf); formatter.Serialize(mstream, SoapEx);
- SoapFormatter formatter = new SoapFormatter(); byte[] buf = new byte[SoapEx.Capacity]; MemoryStream mstream = new MemoryStream(buf); Foreach (object o in SoapEx){formatter.Serialize(mstream, o);}
- SoapFormatter formatter = new SoapFormatter(); MemoryStream mstream = new MemoryStream(); foreach (object o in SoapEx) { Formatter.Serialize(mstream, o); }


CORRECT ANSWER : SoapFormatter formatter = new SoapFormatter(); MemoryStream mstream = new MemoryStream(); formatter.Serialize(mstream, SoapEx);

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement