Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.73 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Is this the best way to determine that a List of ints contains a 0?
  2. if (ALogMsgTypeIntArray.Exists(delegate(int i) { return i == 0; }))
  3. {
  4.     MessageBox.Show("0 exists");
  5. }
  6.        
  7. bGetDebug = ALogMsgTypeIntList.Contains(LogParsePumpViewerConsts.LOG_MSG_TYPE_DEBUG);
  8. bGetInfo = ALogMsgTypeIntList.Contains(LogParsePumpViewerConsts.LOG_MSG_TYPE_INFORMATION);
  9. bGetWarning = ALogMsgTypeIntList.Contains(LogParsePumpViewerConsts.LOG_MSG_TYPE_WARNING);
  10. bGetError = ALogMsgTypeIntList.Contains(LogParsePumpViewerConsts.LOG_MSG_TYPE_ERROR);
  11.        
  12. if (ALogMsgTypeIntArray.Contains(0))
  13. {
  14.     MessageBox.Show("0 exists");
  15. }
  16.        
  17. if (ALogMsgTypeIntArray.Exists(i => i == 0)
  18. {
  19.     MessageBox.Show("0 exists");
  20. }
  21.        
  22. ALogMsgTypeIntArray.Any(item => item == 0)