diff --git a/C#/C#.csproj b/C#/C#.csproj
index 5deb585..2a6ee11 100644
--- a/C#/C#.csproj
+++ b/C#/C#.csproj
@@ -4,8 +4,9 @@
Exe
net6.0
C_
- enable
+ disable
enable
+
diff --git a/C#/Datastructures/LinkedList.cs b/C#/Datastructures/LinkedList.cs
index cb04f29..6738d62 100644
--- a/C#/Datastructures/LinkedList.cs
+++ b/C#/Datastructures/LinkedList.cs
@@ -1,7 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using C_.Datastructures.Nodes;
namespace C_.Datastructures
@@ -27,7 +23,23 @@ namespace C_.Datastructures
public static LinkedList Create(LinkedList list1, LinkedList list2){
//Append a previous list to a new List
- return null;
+ LinkedList list;
+
+ list = list1;
+ if (list == null || list.Count == 0)
+ {
+ //If list 2 is the only list present
+ return list2;
+ }
+
+ //Find end of list and append fist item of next list
+ if (list2 == null || list.Count == 0) return list;
+
+ Node? end = list.Traverse();
+ end!.Next = list2!.Head;
+ list.Count += list2!.Count;
+
+ return list;
}
@@ -60,7 +72,7 @@ namespace C_.Datastructures
private Node? Traverse(){
//Start at Head of list
Node? node = Head;
- if (node == null)
+ if (node != null)
{
//continue to end of list
while (node!.Next != default(Node))
@@ -71,10 +83,10 @@ namespace C_.Datastructures
return node;
}
- private Node Traverse(Node start){
+ private Node? Traverse(Node start){
//Start at given point in list
- Node node = start;
- if (node == null)
+ Node? node = start;
+ if (node != null)
{
//Continue to end of list
while (node!.Next != default(Node))
diff --git a/C#/Program.cs b/C#/Program.cs
index 3751555..aa1412b 100644
--- a/C#/Program.cs
+++ b/C#/Program.cs
@@ -1,2 +1,21 @@
-// See https://aka.ms/new-console-template for more information
+using System;
+using C_.Datastructures;
+
+// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
+
+LinkedList list = new LinkedList();
+
+list.Add(1);
+list.Add(2);
+list.Add(3);
+
+LinkedList list2 = new LinkedList();
+
+list2.Add(1);
+list2.Add(2);
+list2.Add(3);
+
+
+LinkedList list3 = LinkedList.Create(list, list);
+Console.ReadLine();
\ No newline at end of file