Click here to Skip to main content
15,304,161 members

Comments by rj45 (Top 15 by date)

rj45 16-Dec-11 13:38pm View
What do you want to know, I will add it.
rj45 16-Dec-11 13:38pm View
First part of a series.
rj45 8-Nov-11 14:28pm View
The list approach is extremely* slow especially when you factor the foreach required to use it.

Profile it and take a look how terrible foreach is.
Although it is still better than recursive approach.

rj45 8-Nov-11 14:22pm View
Why is that. Explain please.
rj45 2-Nov-11 12:34pm View

rj45 1-Nov-11 15:40pm View
but I did approve it, I hope it does work :)
rj45 1-Nov-11 15:39pm View
It would be pretty slow alternative in terms of performance.
rj45 1-Nov-11 14:12pm View
hah nice!
rj45 28-Oct-11 12:56pm View
Well usually I have an override that doesn't have that parameter but usually you need it. StringReader might be interesting, or some kind of iterator that acts like a cursor in the file.

returning null, isn't needed on errors because the lastMatch parameter returns -1. Although in some versions I had it returning null, I found this to be easier I think.
rj45 27-Oct-11 23:18pm View
thanks this must be old code, I will find my latest version and submit tomorrow.

Your solution is cool but its not many times when your iterating through the same things.

what about this situation
getbetween ( a,b, 0, out last );
getbetween ( c,d,last, last;

I use that all the time.
rj45 27-Oct-11 23:12pm View
Reason for my vote of 4
pretty cool
rj45 27-Oct-11 12:29pm View
Marcus, Singleton means single instance and nothing more. In we multiple scopes of singletons ( not just static ). You may be expecting simply static, which would be single instance server wide, however in that is rarely what we want. My example gives us a single instance per session which is a singleton of the session context. If you want it per Request then you could use HttpContext.Current.Items.add rather than session which is a singleton of the request scope.

As you know, If you want it accessible from throughout the application make the property public static.
rj45 24-Oct-11 17:27pm View
Reason for my vote of 2
a silly idea.
rj45 24-Oct-11 15:15pm View
Did you get a chance to try it, I'd appreciate it if you could change your vote. ( if codeproject lets you do that..)
rj45 18-Oct-11 15:48pm View
I suggest you try it out. I hint may be that it wouldn't work with foreach.

New fangled in regards to not needed recursion, yield, Ienumerable/foreach, Linq, templates. These things are not crap by themselves of course nor new things. They are simply not great IMHO for this simple context. I always laugh when I see the use of things to eliminate a loop or two thats why I posted this.