Здесь немного LinqToSql GOTCHA:
// Returns the number of counties in a state, 
// or all counties in the USA if the state is null
public static int CountCounties(State s) {
  var q = 
    from cy in County.GetTable() // my method to get the ITable
    where (s == null || s.Code == cy.StateCode) // shortcut OR operator, right...?
    select cy;
  return q.Count();
}
Угадайте, что - если вы передаете объект null State этому методу, вы получите исключение с нулевой ссылкой! Похоже, что LinqToSql не использует оператор ярлыка || в качестве ярлыка!
Ответьте на вопрос, кто предложит лучшее объяснение и обходное решение для этого.
