5

In C++, using boost::interprocess you can define a boost::interprocess::basic_string which is basically an abstraction over a string that's stored in a Memory Mapped File. You can seamlessly use it like any other string in your application (assuming of course you take care of thread safety).

Is there any equivalent library/nuget package/piece of code for C#?

Omer Raviv
  • 11,409
  • 5
  • 43
  • 82
  • There's nothing in that Boost class that makes it especially suited in an MMF. Strings in C++ are just a nightmare, every non-trivial library is forced to add its own because it can't rely on the implementation details of another. Don't repeat that mistake, use Encoding.GetBytes(). – Hans Passant Dec 23 '13 at 00:27
  • @HansPassant But I can use a boost::interprocess::allocator that allocated that string in MMF, and can even place those strings in a data-structure that's stored in MMF such as a boost::interprocess::map or boost::interprocess::vector. I'm looking for a similar abstraction in C#, one that abstracts away dealing with streams. – Omer Raviv Dec 23 '13 at 07:39

1 Answers1

1

No. However, even if it were possible to implement transparently, strings in C# are immutable. Therefore I don't think having a library quite like that would be even very useful.

Thorarin
  • 47,289
  • 11
  • 75
  • 111