'Why does Visual Studio accept PriorityQueue?
I'm writing a program that needs a priority queue, and it would be nice if I could use the one that comes with .Net 6: https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.priorityqueue-2?view=net-6.0
So I've tried writing some sample code (in F#, but this particular code fragment could be written just the same in C# and I would expect the results to be the same):
open System.Collections.Generic
...
let pq = PriorityQueue()
pq.Enqueue("apple", 5)
pq.Enqueue("banana", 6)
checkEq (pq.Dequeue()) "apple"
checkEq (pq.Dequeue()) "banana"
Visual Studio is perfectly happy with that, autocomplete worked and everything.
I try to compile it, and fsc is not at all happy:
C:\olivine\src\test.fs(1345,14): error FS0039: The value or constructor 'PriorityQueue' is not defined.
Maybe that's because I don't have the right version of .Net installed.
reg query "HKLM\SOFTWARE\Microsoft\Net Framework Setup\NDP" /s
Needless to say, there seem to be dozens of versions installed, but the highest version numbers I am seeing, appear to be 4.x, which would explain why fsc is not happy.
But then what's up with Visual Studio? How did it accept and understand the reference to PriorityQueue, despite .Net 6 being apparently not installed on the machine?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
