Have your user objects implement IComparable, then return the
response of string.Compare within the interface implementation
method. Then you can use the ArrayList.Sort method. If the user
objects will sorted in different manners, you can instead pass an
object to the ArrayList.Sort method that implements IComparer (say a
LastNameCompare object, or a sorter for your user object that takes
something in it's construction to determine what to sort on) that is
used to sort on LastName.
You said "best", which is subjective. This method to me is very
clean and leverages existing Framework code. Perhaps some other
custom way could be devised which was technically "fastest".
--- In padnug@xxxxxxxxxxxxxxx, "Rich Augelli" <r.augelli@xxxx> wrote:
> Just a quick question for anyone involved in Sort Performance.
>
> What's the best way to sort an Arraylist object composed of user
objects
> containing a LastName property, if you want to sort on LastName
(string
> datatype)?
>
> -----Original Message-----
> From: padnug@xxxxxxxxxxxxxxx [mailto:padnug@xxxxxxxxxxxxxxx] On
Behalf Of
> Justin Collum
> Sent: Tuesday, August 02, 2005 3:12 PM
> To: padnug@xxxxxxxxxxxxxxx
> Subject: Re: [padnug] ASP Controls
>
> I encountered this and fixed it. I think I had to set columns
instead of
> width. Columns = 40 or something like that.
> For things like this I found the FF DOM inspector to be an
invaluable tool.
>
>
> -- Justin
>
> On 8/2/05, Neil Moomey <neil@xxxx> wrote:
> >
> > I've noticed the ASP Web Control TextBox creates the following
in my
> > code sample:
> >
> >
> >
> > <input name="TextboxPlat1" type="text" id="TextboxPlat1"
> > style="width:40px;" />
> >
> >
> >
> > Setting the width to 40px does not seem to work in FireFox. It
looks
> > fine in I.E. but the page looks terrible in FireFox with all the
text
> > boxes being the default width. Is there a work around to this?
Thanks.
> >
> > Neil
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> > ------------------------------
> > YAHOO! GROUPS LINKS
> >
> >
> > - Visit your group "padnug
<http://groups.yahoo.com/group/padnug>"
> > on the web.
> > - To unsubscribe from this group, send an email to:
> >
> padnug-unsubscribe@xxxxxxxxxxxxxxx<padnug-
unsubscribe@xxxxxxxxxxxxxxx?subjec
> t=Unsubscribe>
> > - Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> > Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> > ------------------------------
> >
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hc207m4/M=362335.6886445.7839731.1510227/D=groups/S=1705007709:TM/Y=YAHOO/EXP=1123037799/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/">In
low income neighborhoods, 84% do not own computers. At Network for Good, help
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~->
|