WriteMethodResponse() public static method

public static WriteMethodResponse ( BinaryWriter writer, object obj, Header headers, ISurrogateSelector surrogateSelector, StreamingContext context, FormatterAssemblyStyle assemblyFormat, FormatterTypeStyle typeFormat ) : void
writer System.IO.BinaryWriter
obj object
headers System.Runtime.Remoting.Messaging.Header
surrogateSelector ISurrogateSelector
context System.Runtime.Serialization.StreamingContext
assemblyFormat FormatterAssemblyStyle
typeFormat FormatterTypeStyle
return void
示例#1
0
        public void Serialize(Stream serializationStream, object graph, Header[] headers)
        {
            if (serializationStream == null)
            {
                throw new ArgumentNullException("serializationStream");
            }

            BinaryWriter writer = new BinaryWriter(serializationStream);

            WriteBinaryHeader(writer, headers != null);

            if (graph is IMethodCallMessage)
            {
                MessageFormatter.WriteMethodCall(writer, graph, headers, surrogate_selector, context, assembly_format, type_format);
            }
            else if (graph is IMethodReturnMessage)
            {
                MessageFormatter.WriteMethodResponse(writer, graph, headers, surrogate_selector, context, assembly_format, type_format);
            }
            else
            {
                ObjectWriter serializer = new ObjectWriter(surrogate_selector, context, assembly_format, type_format);
                serializer.WriteObjectGraph(writer, graph, headers);
            }
            writer.Flush();
        }