Re: My First C# (warning - long post)
- From: "Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx>
- Date: Thu, 1 Feb 2007 16:34:57 -0700
andrewmcdonagh<andrewmcdonagh@xxxxxxxxx> 02/01/07 3:37 PM >>>
On Feb 1, 10:31 pm, "Frank Swarbrick" <Frank.Swarbr...@xxxxxxxxxxxxxx>the
wrote:
LX-i<lxi0...@xxxxxxxxxxxx> 02/01/07 7:51 AM >>>
Along those lines - is there a better way to search through an array
other than "for (int i = 0; i < array.length; i++)"?
I'm not sure specifically what you are referring to, but, if we assume
above code is something like
string array[] = new string[10];
for (int i = 0; i < array.length; i++)
{
doSomething(array[i]);
}
You can replace it with
foreach (string s in array)
{
doSomething(s);
}
Good call, the other approach is to use Predicates....
see: http://www.c-sharpcorner.com/UploadFile/vandita/
PredicatesInArray10232006063515AM/PredicatesInArray.aspx
Definitely cool. I had never heard of it before. Nice use of a delegate.
Frank
---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO USA
.
- References:
- Re: [OT] My First C# (warning - long post)
- From: LX-i
- Re: [OT] My First C# (warning - long post)
- From: Pete Dashwood
- Re: [OT] My First C# (warning - long post)
- From: LX-i
- Re: [OT] My First C# (warning - long post)
- From: Frank Swarbrick
- Re: My First C# (warning - long post)
- From: andrewmcdonagh
- Re: [OT] My First C# (warning - long post)
- Prev by Date: Re: [OT] My First C# (warning - long post)
- Next by Date: Re: My First C# (warning - long post)
- Previous by thread: Re: My First C# (warning - long post)
- Next by thread: Re: My First C# (warning - long post)
- Index(es):
Relevant Pages
|