I'm storing multiple values in session by retrieve & assign values from the session like this :
var imageSessList = (List<string>)Session["ImagesNames"];
if (imageSessList != null)
{
string image1 = imageSessList[0];
string image2 = imageSessList[1];
string image3 = imageSessList[2];
string image4 = imageSessList[3];
}
but what if the session contain only 3 values, so while assigning string image4 = imageSessList[3];
it throws null error.
how to handle null in such situation.