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;
}