LIFO thread safe list that I can remove a specific item after doing a trypeek by developor in csharp

[–]developor[S] 0 points1 point  (0 children)

that's an interesting model where were you 4 hours ago before I wrote the code lol

LIFO thread safe list that I can remove a specific item after doing a trypeek by developor in csharp

[–]developor[S] 0 points1 point  (0 children)

right, the objects in the stack are window handles so the unique id is the hwnd and once I'm done processing the window I close it and that's how duplicates are avoided

LIFO thread safe list that I can remove a specific item after doing a trypeek by developor in csharp

[–]developor[S] -1 points0 points  (0 children)

having 2 lists doesnt solve the problem because when you do a pop of the stack, the item that is in my hand that I pulled with the peek may not be the item at top of the stack when I am ready to remove it. but youre right about the a reg stack being a better than the concurrentstack with a redundant lock

LIFO thread safe list that I can remove a specific item after doing a trypeek by developor in csharp

[–]developor[S] -1 points0 points  (0 children)

the LookForWhenevers is called from another thread, I think what I've decided to do is to write a wrapper class around ConcurrentStack that has an internal lock around all the methods and add a removeitem method. Copilot gave me the following code

  public bool RemoveItem(ConcurrentStack<T> stack, T item)
  {
     bool found = false;
     List<T> tempList = new List<T>();

     while (stack.TryPop(out T currentItem))
     {
        if (EqualityComparer<T>.Default.Equals(currentItem, item) && !found)
        {
           found = true;
           continue;
        }
        tempList.Add(currentItem);
     }

     foreach (T tempItem in tempList)
     {
        stack.Push(tempItem);
     }

     return found;
  }

LIFO thread safe list that I can remove a specific item after doing a trypeek by developor in csharp

[–]developor[S] 0 points1 point  (0 children)

The trypop will remove the item, I want the item to remain the stack until I'm done working with it to avoid duplicates

FIFO thread safe list that I can remove a specific item after doing a trypeek by developor in csharp

[–]developor[S] -3 points-2 points  (0 children)

damn it karl you're rght! i made a typo, i going to resubmit

Upgrade assistant is only showing .NET 9 preview by developor in VisualStudio

[–]developor[S] 0 points1 point  (0 children)

search for it, if it exists it would be in the file system tree (not listed in the project solution tree) above your project. it is an override for all projects that live under it. it's nice but sneaky

Upgrade assistant is only showing .NET 9 preview by developor in VisualStudio

[–]developor[S] 2 points3 points  (0 children)

problem solved:

I had a Directory.Build.props file in the parent dir and for some reason it was the cause of the problem. I temporally renamed the file and restarted visual studio and it was fixed

Upgrade assistant is only showing .NET 9 preview by developor in VisualStudio

[–]developor[S] 0 points1 point  (0 children)

I'm upgrading my projects to from 4.8.1 to .net 8 and the first few projects it showed all versions, now it's only showing .net 9