C# - How to get number of walls that are enclosing a room?

So I am trying to write code that will determine number of walls that are enclosing a room, IE: rectangle would have 4, pentagon 5 and etc…

I assumed that the Room element would contain boundary objects in form of an array that enclose it and I would be able to count them, but haven’t been successful at finding them…

Any suggestions on where I can look?

Thanks in Advance!

Does this help point you in the right direction?