My friend Jesse showed me a cool little technique for introspecting a string array using Linq. Of course I realize that there a ton more fascinating Linq tutorials out there but this one showed me just how sweeping the effects of Linq are.
I first thought that Linq was just a neat way of generating a provider based Data Access Layer. Now I know that Linq can come in handy in a much broader array of solutions.
1: string[] textKeys = { "str1", "str2", "str3", "str4", "str5"}; 2:
3: if (textKeys.Contains("str1")) 4: { 5: //do something here
6: }
As I learn more about LINQ I will try to add some posts that actually provide more real-world value.
P.S. You will need to have "using System.Linq;" in your 'using' statements.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5