From e8c99f8d5d239ef0d77a1eef7b92dfcc5d6e6d20 Mon Sep 17 00:00:00 2001 From: Luke Else Date: Tue, 19 Apr 2022 21:29:25 +0100 Subject: [PATCH] Updated Linked List to allow for null value to be added --- C#/Datastructures/LinkedList/LinkedList.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/C#/Datastructures/LinkedList/LinkedList.cs b/C#/Datastructures/LinkedList/LinkedList.cs index 4aa9453..9820811 100644 --- a/C#/Datastructures/LinkedList/LinkedList.cs +++ b/C#/Datastructures/LinkedList/LinkedList.cs @@ -11,7 +11,7 @@ namespace C_.Datastructures.LinkedList return new LinkedList(); } - public static LinkedList Create(T value) + public static LinkedList Create(T? value) { //Create a new Class with a single item return new LinkedList() @@ -62,7 +62,7 @@ namespace C_.Datastructures.LinkedList } } - public void Append(T value) + public void Append(T? value) { //Create new node Count++; @@ -86,7 +86,7 @@ namespace C_.Datastructures.LinkedList end!.Next = newItem; } - public void Insert(int index, T value) + public void Insert(int index, T? value) { Count++; if (index > Count || index < 0) throw new System.Exception("Error! Index outside of Bounds");