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
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
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•3mo ago
Message Not Public
Sign In & Join Server To View
Okay thank you, but what does it mean by "does not persist changes"?
Yea
It's adhoc. It knows nothing about the file system
It can't save anything you do with TryApplyChanges
So it cannot write to file basically?
Think of Stream; you have Adhoc, which is a memorystream, and something like msbuild, which is a filestream
So i can make changes to adhoc, but it wont save the changes to the file?
there is no file in the first place
Oh i see, okay thank you
it is just an in-memory thing
Okay i got the idea now, thanks