C
C#4mo ago
Potassium

Whats the difference between Workspace and AdhocWorkspace?

Im currently trying to learn roslyn api. In Microsoft.CodeAnalysis namespace, there is two classes named AdhocWorkspace and Workspace. Whats the difference between these two? Which one i should use?
12 Replies
Potassium
PotassiumOP4mo ago
The only description about AdhocWorkspace in learn.microsoft.com is that it allows full manipulation and does not persist changes, but i have no idea what that mean
333fred
333fred4mo ago
A workspace is an abstraction around a solution An adhocworkspace is a specific implementation, that you manually populate (in an adhoc fashion) Also, #roslyn is the best place to ask these questions
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
Potassium
PotassiumOP4mo ago
Okay thank you, but what does it mean by "does not persist changes"? Yea
333fred
333fred4mo ago
It's adhoc. It knows nothing about the file system It can't save anything you do with TryApplyChanges
Potassium
PotassiumOP4mo ago
So it cannot write to file basically?
333fred
333fred4mo ago
Think of Stream; you have Adhoc, which is a memorystream, and something like msbuild, which is a filestream
Potassium
PotassiumOP4mo ago
So i can make changes to adhoc, but it wont save the changes to the file?
reflectronic
reflectronic4mo ago
there is no file in the first place
Potassium
PotassiumOP4mo ago
Oh i see, okay thank you
reflectronic
reflectronic4mo ago
it is just an in-memory thing
Potassium
PotassiumOP4mo ago
Okay i got the idea now, thanks
Want results from more Discord servers?
Add your server