Checking for duplicates in an object array?
<p>I have the following object array, created from a custom class Room.  Before I add a new Room to the array I want to verify that the Roomname is not already in the array.  Here is a sample of what I am trying:</p>

<pre><code>private void btnAddRm_Click(object sender, EventArgs e)
{
Room[] roomArray = new Room[20];
test = txtName.text;

for (int i = 0; i &lt; roomArray.length; i++)
{
     if(test != roomArray[i].getRoomName())
     {
          addRoom();
     }
}
}
</code></pre>

<p><code>GetRoomName()</code> is the accessor that retrieves the <code>RoomName</code> from the class.  I guess my question is why is this code not working?  </p>

<p>Thank you</p>
