Re: Swap nodes in a linked list

Brady Kelly <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
No Frans, if anyone is being dense it is I.  My problem stems from finding a
node at a position, and the only means apparent to me is by using extension
method 'ElementAt' which returns element of type T at a given index, and
then using intrinsic method 'Find' to find the node containing that element.


> > Sorry if this is very obvious, but it escapes me now at a time of
> impending
> > review.  I have a LinkedList<BandLine>, representing a report Band,
> where
> > BandLine is one line of text in the band, e.g. one of two detail line
> types,
> > or a header line.
> >
> > I present my linked list using a DataGridView, and am trying to
> implement
> > 'Move Up' and 'Move Down' commands for band lines, which involves
> swapping
> > nodes in my linked list.  Now getting the BandLine to move is easy,
> using
> > ElementAt and an index provided by the grid, but to complete the swap
> with
> > AddBefore, I need a LinkedListNode at a specific index.  How can I
> get this?
>
>         Sorry for being dense, but moveup/down is that the same as
> moving one
> position up/down? I.o.w.: move node at post X to pos X-1? Which means
> in a
> linked list (if first element is the top element in the list) to move
> the node
> at pos X in front of X.Previous
>
>
>                 FB

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.