Using Microsoft.VisualBasic (or other ways of getting memory info)

I know what you’re thinking: “why on earth are you worried about Visual Basic libraries in Unity?”

I’m trying to get some system memory information, and according to this thread I can get what I need with VisualBasic.Devices. If you have other suggestions for getting memory information (e.g. RSS and available system memory), I certainly recognize that I am not a power programmer and I’m open to any suggestions.

Within Visual Studio I can add a reference to Microsoft.VisualBasic and then include it in my C# code through ‘using’ directives. However, I’ve noticed that the version being used is .NET 4.0 (so I can’t just import it into Unity), and when I try to grab the .NET framework 2.0 from the Microsoft site it tells me that it’s already installed, even though I only see the 3.0, 3.5, and 4.0 frameworks on my (Windows) system (Program Files\Reference Assemblies\Microsoft\Framework)

So in summary, I have 3 questions:

  • Is there a recommended way within the Unity framework to query the amount of memory in use by the application and the amount of available memory?
  • If not, is there any way to get the VisualBasic.dll for, say, .NET 4.0 to work in Unity?
  • If not, can you tell me how/where I would go about getting the VisualBasic.dll for .NET 2.0?

There may be some clues here (Windows):