Hi, I have a home assignment in C#, I need to make a simple one-way linked list and I'm having trouble. I can make all kinds of linked lists in C++ with no problem at all but I can't do it in C# and that's because I can't access memory directly so no pointers for me.
Now this is where the fun begins. Where the hell do I start? I don't want to use templates, I need to make it by myself. I just don't know what should I do to replace * and -> in C#?
This is what I've got so far.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
//CLASS NODE
public class Node
{
int userinput;
Node p_next;
void Add();
void Print();
}
//CLASS LIST
public class List
{
Node p_start;
void PrintAll();
void AddToStart();
void AddToEnd();
}
//MAIN
public static void Main(string[] args)
{
List MyList = new List();
MyList.p_start = null; <- !?!?
}
}
}
So how do I go about creating a new List in Main() and creating new pointers?