Opc.Ua.BinaryDecoder.DecodeMessage C# (CSharp) Method

DecodeMessage() public static method

Decodes a message from a stream.
public static DecodeMessage ( Stream stream, System expectedType, ServiceMessageContext context ) : IEncodeable
stream Stream
expectedType System
context ServiceMessageContext
return IEncodeable
        public static IEncodeable DecodeMessage(Stream stream, System.Type expectedType, ServiceMessageContext context)
        {
            if (stream == null) throw new ArgumentNullException("stream");
            if (context == null) throw new ArgumentNullException("context");
                        
            BinaryDecoder decoder = new BinaryDecoder(stream, context);

            try
            {
                return decoder.DecodeMessage(expectedType);
            }
            finally
            {
                decoder.Close();
            }
        }
        

Same methods

BinaryDecoder::DecodeMessage ( System expectedType ) : IEncodeable
BinaryDecoder::DecodeMessage ( byte buffer, System expectedType, ServiceMessageContext context ) : IEncodeable

Usage Example

コード例 #1
0
        /// <summary>
        /// Decodes a message from a buffer.
        /// </summary>
        public static IEncodeable DecodeMessage(byte[] buffer, System.Type expectedType, ServiceMessageContext context)
        {
            if (buffer  == null) throw new ArgumentNullException("buffer");
            if (context == null) throw new ArgumentNullException("context");

            BinaryDecoder decoder = new BinaryDecoder(buffer, context);

            try
            {
                return decoder.DecodeMessage(expectedType);
            }
            finally
            {
                decoder.Close();
            }
        }