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

ReadEncodeable() public method

Reads an encodeable object from the stream.
public ReadEncodeable ( string fieldName, System systemType ) : IEncodeable
fieldName string
systemType System
return IEncodeable
        public IEncodeable ReadEncodeable(string fieldName, System.Type systemType)
        {
            if (systemType == null) throw new ArgumentNullException("systemType");

            IEncodeable encodeable = Activator.CreateInstance(systemType) as IEncodeable;

            if (encodeable == null)
            {
                throw new ServiceResultException(
                    StatusCodes.BadDecodingError,
                    Utils.Format("Cannot decode type '{0}'.", systemType.FullName));
            }

            encodeable.Decode(this);

            return encodeable;
        }