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

Does this help point you in the right direction?