1

How would I check if an ObjectIdentifier is parent/root of another ObjectIdentifier?

For example:

ObjectIdentifier rootId = ...;
Variable variable = ...;
if (rootId.IsRootOf(variable.Id))
{
    // The variable's id is a child of root id!
}

I can't seem to find any method like that in SnmpSharpNet.

Vapid
  • 701
  • 7
  • 27

1 Answers1

0

rootId is a parent if this is true

is-equal (rootId, variableId, len(rootId))

Gambit Support
  • 1,432
  • 1
  • 7
  • 17
  • Could you expand on this answer? I am not sure what you mean. How would I implement this IsEqual method? – Vapid Jan 14 '20 at 15:55
  • 1
    Your API must have a comparison operation on OID type for a certain length. Since OIDs are hierarchical, if they are the same upto the length of the smaller of the 2, then by definition the smaller of the 2 is the parent of the longer. – Gambit Support Jan 14 '20 at 17:27