how to call an If statement only once in csharp

Code Example - how to call an If statement only once in csharp

                
                        boolean firstRow = true;

while{row = result.next())
{
    if(firstRow)
    {
        firstRow = false;
        //do some setup 
    }

    //do stuff
}