0

Say I have a collection that I want to filter on...

 var users = groupInner.GetMembers(true).Where(user => user.Name.ToUpper().StartsWith("D0") == false && 
     user.Name.ToUpper().StartsWith("D1") == false &&
     user.Name.ToUpper().StartsWith("D2") == false &&
     user.Name.ToUpper().StartsWith("D3") == false &&
     user.Name.ToUpper().StartsWith("D4") == false).ToList();

When filtering with the where clause on text, I can only get the statement to work with =>. == doesn't seem to work. I've tested it, the above code gives me my correct answer, but just for understanding and to find out if I should using something more appropriate than what I already have...what does => mean when comparing text and is there something I should be using instead?

Jason R.
  • 379
  • 1
  • 6
  • 19

1 Answers1

2

That's the syntax for indicating a lambda expression. It's called the "lambda operator". See:

http://msdn.microsoft.com/en-us/library/bb397687.aspx

To create a lambda expression, you specify input parameters (if any) on the left side of the lambda operator =>, and you put the expression or statement block on the other side.

rory.ap
  • 34,009
  • 10
  • 83
  • 174