Condensing if statement in C#
Shouldn't you replace the whole code with session = String.Empty; ?

Let's assumme that this is just a placeholder for actual code. If you handle your different cases in order and if hours is an int, then you can make the logic a bit easier to follow :

if (hours == 23 || (hours &gt;= 0 &amp;&amp; hours &lt;= 6))
{
    session = A;
}
else if (hours == 7)
{
    session = B;
}
else if (hours &gt;= 8 &amp;&amp; hours &lt;= 11)
{
    session = C;
}
else if (hours &gt;= 12 &amp;&amp; hours &lt;= 15)
{
    session = D;
}
else if (hours &gt;= 16 &amp;&amp; hours &lt;= 20)
{
    session = E;
}
else if (hours == 22)
{
    session = F;
}
else
{
    session = G;
}


becomes

if (hours &lt; 0 || hours &gt; 23)
{
    session = G;
}
else if (hours &lt;=6)
{
    session = A;
}
else if (hours &lt;= 7)
{
    session = B;
}
else if (hours &lt;= 11)
{
    session = C;
}
else if (hours &lt;= 15)
{
    session = D;
}
else if (hours &lt;= 20)
{
    session = E;
}
else if (hours &lt;= 22)
{
    session = F;
}
else
{
    session = A;
}