first time posting on here and a bit of a noob in c#. Basically I'm creating a linkedlist and initializing it to null at the beginning of my class. When I'm ready to use it, I check to make sure that it's not equal to the string passed by the method. I immediately get a NullReferenceException, and i'm supposed to be comparing it to null. Any fixes?
private DoubleLinkedListCell<DoubleLinkedListCell<GamePiece>> _columns = null;
public void FindColumn(string columnId)
{
bool right = true;
while (_columns.Id != columnId)
{
if (_columns.Next == null)
{
right = false;
}
if (right)
{
Columns = Columns.Next;
}
else
{
Columns = Columns.Prev;
}
}
}