Question: C# I want to run this code without use the System.Collections.Generic library public bool test(x test, x test2) where x : class { return (test
C#
I want to run this code without use the System.Collections.Generic library
public bool test(x test, x test2) where x : class { return (test == test2); } public void Delete(T value) { Node temp = head; // if (temp != null && temp.Value == value) //if (temp != null && EqualityComparer.Default.Equals(temp.Value, value) == true) if (temp != null && test(temp.Value, value) == true) { head = temp.Next; if (head != null) { head.Previous = null; } return; } // while (temp != null && temp.Value != value) // while (temp != null && EqualityComparer.Default.Equals(temp.Value, value) != true) while (temp != null && test(temp.Value, value) != true) { temp = temp.Next; } if (temp == null) { return; } if (temp.Next != null) { temp.Next.Previous = temp.Previous; } if (temp.Previous != null) { temp.Previous.Next = temp.Next; } }
the node for Generic doubly linked list. And I want to delete function to work with both int and string
2 references public bool test(x test, x test2) where x : class return (test == test2); 2 references public void Delete(t value) Node temp = head; // if (temp != null && temp.Value == value) //if (temp != null && Equality Comparer.Default.Equals(temp.Value, value) == true) if (temp != null && test(temp.Value, value) == true) { head: = temp. Next; if (head != null) { head. Previous = null; } return; } // while (temp != null && temp.Value != value) // while (temp != null && Equality Comparer.Default.Equals(temp.Value, value) != true) while (temp != null && test(temp.Value, value) != true) { temp = temp. Next; if (temp == null) return; if (temp. Next != null) temp. Next. Previous = temp. Previous; if (temp. Previous != null) temp. Previous. Next = temp. Next; 2 references public bool test(x test, x test2) where x : class return (test == test2); 2 references public void Delete(t value) Node temp = head; // if (temp != null && temp.Value == value) //if (temp != null && Equality Comparer.Default.Equals(temp.Value, value) == true) if (temp != null && test(temp.Value, value) == true) { head: = temp. Next; if (head != null) { head. Previous = null; } return; } // while (temp != null && temp.Value != value) // while (temp != null && Equality Comparer.Default.Equals(temp.Value, value) != true) while (temp != null && test(temp.Value, value) != true) { temp = temp. Next; if (temp == null) return; if (temp. Next != null) temp. Next. Previous = temp. Previous; if (temp. Previous != null) temp. Previous. Next = temp. Next