Handling pointers to structure in C#
<p>I'm working on project which includes DLL written in C++ and a C# code. Lets say that that DLL has a function:</p>

<pre><code>MyStruct* GetPointer(); // returns pointer to MyStruct structure
</code></pre>

<p>MyStruct structure looks like this:</p>

<pre><code>struct MyStruct
{
    OtherStruct1 *data1;
    OtherStruct2 *data2;
};
</code></pre>

<p>And OtherStruct1 and OtherStruct2 structures look like this:</p>

<pre><code>struct OtherStruct1
{
public:
    double x;
    char y;
};

struct OtherStruct2
{
public:
    float a;
    float b;
    float c;
    float d;
};
</code></pre>

<p>My question is - what's the best way to handle all of these pointers in a C# code? By "handling" i mean operations of reading from and writing to memory. Structures in C# can't simply contain pointer variables. What am I supposed to do? What's the most elegant way?</p>