Opc.Ua.Client.NodeCache.IsEncodingFor C# (CSharp) Method

IsEncodingFor() public method

Determines if the value contained in an extension object value matches the expected data type.
public IsEncodingFor ( NodeId expectedTypeId, ExtensionObject value ) : bool
expectedTypeId NodeId The identifier of the expected type .
value ExtensionObject The value.
return bool
        public bool IsEncodingFor(NodeId expectedTypeId, ExtensionObject value)
        {
            // no match on null values.
            if (value == null)
            {
                return false;
            }
            
            // check for exact match.
            if (expectedTypeId == value.TypeId)
            {                
                return true;
            }
            
            // find the encoding.
            ILocalNode encoding = Find(value.TypeId) as ILocalNode;

            if (encoding == null)
            {
                return false;
            }

            // find data type.
            foreach (IReference reference in encoding.References.Find(ReferenceTypeIds.HasEncoding, true, true, m_typeTree))
            {
                if (reference.TargetId == expectedTypeId)
                {
                    return true;
                }
            }

            // no match.
            return false;
        }

Same methods

NodeCache::IsEncodingFor ( NodeId expectedTypeId, object value ) : bool