.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LinkedList in VS2005 and VB.net

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
251 Views, 4 Replies

LinkedList in VS2005 and VB.net

Hi,

I am connecting to AutoCAD 2008 through the COM api's and am using a
linkedlist(of CustomPointObject) from the system.collections.generic
namespace. I have been trying to find an example of the linklist being used
to sort items in the list. For example each CustomPointObject as an "x",
"y", and "z" property along with some other properties. I would like to see
an example of someone using the same linkedlist and using it to sort by
certain properties of the objects contained in the list. I am hoping that I
will be able to see an example and apply that to my application. Does
anyone have any insight into this situation? I would like to continue using
the linkedlist if possible or find another linkedlist class online that has
some built in sorting capabilities.

Any ideas on where I can look?

Thank you for any help or insight.
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

Can you elucidate on why you chose the LinkedList<>
class for storing your data, in preference to something
like the List<> class?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Tim J" wrote in message news:5535202@discussion.autodesk.com...
Hi,

I am connecting to AutoCAD 2008 through the COM api's and am using a
linkedlist(of CustomPointObject) from the system.collections.generic
namespace. I have been trying to find an example of the linklist being used
to sort items in the list. For example each CustomPointObject as an "x",
"y", and "z" property along with some other properties. I would like to see
an example of someone using the same linkedlist and using it to sort by
certain properties of the objects contained in the list. I am hoping that I
will be able to see an example and apply that to my application. Does
anyone have any insight into this situation? I would like to continue using
the linkedlist if possible or find another linkedlist class online that has
some built in sorting capabilities.

Any ideas on where I can look?

Thank you for any help or insight.
Message 3 of 5
Anonymous
in reply to: Anonymous

I chose the LinkedList for two reasons, the previous version my application
(vb6) used a linklist that was very easy to use (I did not do any sorting
however). And second, because it is likely that I will be
inserting/removing items at various positions in the list and because of
that I thought the linkedlist would be the way to go. My knowledge and
experience in .net is somewhat limited so if there is a different collection
or list object that would be easier to use or have the functionality that I
need, I am open to changing to that object. I will do some investigation
regarding the List class. Do you believe it would be a better choice?

"Tony Tanzillo" wrote in message
news:5535358@discussion.autodesk.com...
Can you elucidate on why you chose the LinkedList<>
class for storing your data, in preference to something
like the List<> class?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Tim J" wrote in message
news:5535202@discussion.autodesk.com...
Hi,

I am connecting to AutoCAD 2008 through the COM api's and am using a
linkedlist(of CustomPointObject) from the system.collections.generic
namespace. I have been trying to find an example of the linklist being used
to sort items in the list. For example each CustomPointObject as an "x",
"y", and "z" property along with some other properties. I would like to see
an example of someone using the same linkedlist and using it to sort by
certain properties of the objects contained in the list. I am hoping that I
will be able to see an example and apply that to my application. Does
anyone have any insight into this situation? I would like to continue using
the linkedlist if possible or find another linkedlist class online that has
some built in sorting capabilities.

Any ideas on where I can look?

Thank you for any help or insight.
Message 4 of 5
Anonymous
in reply to: Anonymous

Have a look at these classes in the docs:

System.Collections.Generic.SortedList<>
System.Collections.Generic.SortedDictionary<>

You can also use the List<> class which, has
methods for sorting its contents.

This example uses Comparison to compare
elements:

public struct point
{
public point(int x, int y)
{
this.x = x; this.y = y;
}
public int x;
public int y;
}

List points = new List();

points.Add( new point(12, 24) );
points.Add( new point(20, 34) );
points.Add( new point(40, 32) );

// Sort on x field:

points.Sort(delegate(point a, point b)
{
return a.x.CompareTo(b.x);
} );

// Sort on y field:

points.Sort(delegate(point a, point b)
{
return a.y.CompareTo(b.y);
} );

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Tim J" wrote in message news:5535465@discussion.autodesk.com...
I chose the LinkedList for two reasons, the previous version my application
(vb6) used a linklist that was very easy to use (I did not do any sorting
however). And second, because it is likely that I will be
inserting/removing items at various positions in the list and because of
that I thought the linkedlist would be the way to go. My knowledge and
experience in .net is somewhat limited so if there is a different collection
or list object that would be easier to use or have the functionality that I
need, I am open to changing to that object. I will do some investigation
regarding the List class. Do you believe it would be a better choice?

"Tony Tanzillo" wrote in message
news:5535358@discussion.autodesk.com...
Can you elucidate on why you chose the LinkedList<>
class for storing your data, in preference to something
like the List<> class?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Tim J" wrote in message
news:5535202@discussion.autodesk.com...
Hi,

I am connecting to AutoCAD 2008 through the COM api's and am using a
linkedlist(of CustomPointObject) from the system.collections.generic
namespace. I have been trying to find an example of the linklist being used
to sort items in the list. For example each CustomPointObject as an "x",
"y", and "z" property along with some other properties. I would like to see
an example of someone using the same linkedlist and using it to sort by
certain properties of the objects contained in the list. I am hoping that I
will be able to see an example and apply that to my application. Does
anyone have any insight into this situation? I would like to continue using
the linkedlist if possible or find another linkedlist class online that has
some built in sorting capabilities.

Any ideas on where I can look?

Thank you for any help or insight.
Message 5 of 5
Anonymous
in reply to: Anonymous

Hey Tony, thanks for your input. I will take a look at the classes that you
suggested. From what I see so far, I think they may suit my needs better
than the linkedlist. I appreciate your direction.

Thanks again.

"Tony Tanzillo" wrote in message
news:5535650@discussion.autodesk.com...
Have a look at these classes in the docs:

System.Collections.Generic.SortedList<>
System.Collections.Generic.SortedDictionary<>

You can also use the List<> class which, has
methods for sorting its contents.

This example uses Comparison to compare
elements:

public struct point
{
public point(int x, int y)
{
this.x = x; this.y = y;
}
public int x;
public int y;
}

List points = new List();

points.Add( new point(12, 24) );
points.Add( new point(20, 34) );
points.Add( new point(40, 32) );

// Sort on x field:

points.Sort(delegate(point a, point b)
{
return a.x.CompareTo(b.x);
} );

// Sort on y field:

points.Sort(delegate(point a, point b)
{
return a.y.CompareTo(b.y);
} );

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Tim J" wrote in message
news:5535465@discussion.autodesk.com...
I chose the LinkedList for two reasons, the previous version my application
(vb6) used a linklist that was very easy to use (I did not do any sorting
however). And second, because it is likely that I will be
inserting/removing items at various positions in the list and because of
that I thought the linkedlist would be the way to go. My knowledge and
experience in .net is somewhat limited so if there is a different collection
or list object that would be easier to use or have the functionality that I
need, I am open to changing to that object. I will do some investigation
regarding the List class. Do you believe it would be a better choice?

"Tony Tanzillo" wrote in message
news:5535358@discussion.autodesk.com...
Can you elucidate on why you chose the LinkedList<>
class for storing your data, in preference to something
like the List<> class?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Tim J" wrote in message
news:5535202@discussion.autodesk.com...
Hi,

I am connecting to AutoCAD 2008 through the COM api's and am using a
linkedlist(of CustomPointObject) from the system.collections.generic
namespace. I have been trying to find an example of the linklist being used
to sort items in the list. For example each CustomPointObject as an "x",
"y", and "z" property along with some other properties. I would like to see
an example of someone using the same linkedlist and using it to sort by
certain properties of the objects contained in the list. I am hoping that I
will be able to see an example and apply that to my application. Does
anyone have any insight into this situation? I would like to continue using
the linkedlist if possible or find another linkedlist class online that has
some built in sorting capabilities.

Any ideas on where I can look?

Thank you for any help or insight.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost