From 3f97e4b770f47e717cde477bbced1cc97f87f99a Mon Sep 17 00:00:00 2001 From: Luke Else Date: Tue, 12 Apr 2022 16:03:10 +0100 Subject: [PATCH] Fixed CS0019 Error - Cannot assume type T is a reference type but instead can infer that a default node can mean that the tree is empty --- C#/Datastructures/BinarySearchTree/Tree.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/C#/Datastructures/BinarySearchTree/Tree.cs b/C#/Datastructures/BinarySearchTree/Tree.cs index 33cd490..146c456 100644 --- a/C#/Datastructures/BinarySearchTree/Tree.cs +++ b/C#/Datastructures/BinarySearchTree/Tree.cs @@ -44,17 +44,16 @@ namespace C_.Datastructures.BinarySearchTree //Insert to right node.Right = TreeNode.Create(value); return; - - } public bool Find(T? value){ - if (Root.Value != default || Root.Value == value) + if (Root == default) { } } + private TreeNode? Descend(T value, TreeNode? current) {//Keep trying to determine whether to go left or right until null node is found that can be appended to if (current == default)