How to check if two values are in the same child of a class? - C#