Do not check error when getting null? RRS feed

  • Question

  • I debuger it.

    var id = pos.Descendants("div").Where(x => x.GetAttributeValue("id", "") == i + "-" + j); // id is getting null after it go to foreach there

    foreach(var n in id)// at here id still is null return at  x.GetAttributeValue("id", "") == i + "-" + j) and go to "}" tag at bottom


                                         else // It was not checking this part.




                              }// and it will be there "}" is close other tag 

    I dont understand Why was It  return "else?.

    Friday, April 10, 2015 2:35 PM

All replies

  • Can you please clarify the question. I have no idea what you are doing here, what behaviour you expect, or how it differs from the actual behaviour.

    If I had to make a guess I'd say that pos.Descendants don't include any divs with the ID you're looking for, but you don't say what pos is, what Descendants does, etc. I can make some guesses, but if you want help it would be better for you to provide enough details that we don't have to guess.

    Saturday, April 11, 2015 2:10 AM