Linked list

monito

New member
Joined
Aug 19, 2018
Messages
1
Programming Experience
Beginner
I am a beginner to C# and not familiar with LINKED LIST. Can someone shed some light on what I am missing to complete the following C# project? my issue is how to use LINKEDLIST.
ReadSTL rs = new ReadSTL(@"c:\devdept\bunny.stl");
rs.DoWork();
rs.AddToScene(viewportLayout1);

Mesh m = (Mesh) rs.Entities[0];
m.ColorMethod = colorMethodType.byEntity;
m.Color = Color.Aquamarine;

Plane p = Plane.XY;

LinkedList[] edgesPerVertex;
Utility.GetEdgesWithoutDuplicates(m.Triangles, m.Vertices.Length, out edgesPerVertex);

int num = 100;

List<Entity> sections = new List<Entity>(num);

for (int iz = 0; iz < num; iz++)
{
    p.Translate(new Vector3D(0, 0, m.BoxSize.Z / num));

    ICurve[] sCurves = m.Section(p, 0, edgesPerVertex);

    foreach (Entity c in sCurves)
    {
        sections.Add(c);
    }
}

viewportLayout1.Entities.AddRange(sections, Color.Blue);
 
How are we supposed to tell you what you're missing when you haven't told us what you're trying to achieve and what specific difficulty you're having? Why should we have to work out what you're trying to do from code that doesn't do it? You haven't even told us why you think you need to use a LinkedList in the first place. Maybe that's the issue: you shouldn't be using one. It's not for us to guess or work out things that you already know; it's for you to tell us. Provide a FULL and CLEAR explanation of your issue.

In general, the point of a linked list is that you have a series of items that each provide a reference to the next item. That's it, that's all. They don't get used all that much in C# because there's rarely a good reason to, because there are so many other data structures that are more convenient in most situations, e.g. List<T>.

Try this real life example of a linked list. Let's say that there are 50 people in a room and all but one of those people has a photo in their pocket of another person in the room and all those photos are unique. You can walk into that room and select any person and ask them to show you the photo they have and then go to that person in the photo and do the same. Eventually, you'll get to a person with no photo. Congratulations! You just traversed a linked list.
 
Back
Top Bottom