If root == null when this is called, there's no reason for this function to work, it should be causing a stack overflow when it call itself over and over again.
If root == null when this is called, there's no reason for this function to work, it should be causing a stack overflow when it call itself over and over again... public void Add(T data) { if (root == null) { this. Add(data); // recurse?!? So, if you're successfully calling it there seems to be three options: You've managed to configure your compiler optimizations so that it's removing the call (this seems unlikely, but I guess could be possible).
You're never be calling it with root==null, which means something else is modifying root, possible since it's protected, however if the usage code you've provided is correct, this shouldn't be the case, since you don't mention a derived class. Your usage code is paraphrased and really you're calling add from within a try/catch block and ignoring the exception that's getting thrown. As I've said in my comment, removing the extra call to this.
Add(data), should fix your problem (with populating the list), however, I'd suggest you step through the function calls in the debugger, so that you can see what's going on. I'd be interest to know if it really calls the 'Add' function. As far as retrieving information from the list, the get function looks like it should work, assuming information has been put into the list correctly and you're calling get on the same list that the data was inserted into.
Again, if it's not working, the debugger is your friend when trying to figure out which bit isn't populated the way you'd expect it to be.
As pointed out by @forsvarir: You should not call Add again when no root node exists. Just remove that call and everything will be fine. If I were you I would not add Indexer or a GetAt method to a LinkedList implementation.It's quite inefficient to use a linked list of you need to have index access.
Make your list implement IEnumerable instead and let the users use LINQ.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.