Memory address of an integer in C#
<p>I am trying to get the memory address for a low-memory trick from an int pointer in C#. However, when I check the output, it seems to be printing the int's value, not its memory address. Below is my code:</p>

<pre><code>using (XmlWriter writer = XmlWriter.Create(newBuilder))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("Data");

                GCHandle handle = GCHandle.Alloc(Nodes, GCHandleType.Normal); 
                //fixed(int * p = &amp;Nodes[0].value) {
                    for (int i = 0; i &lt; Nodes.Count; i++)
                    {
                        writer.WriteStartElement("Node");
                        writer.WriteStartElement("Value");
                        writer.WriteValue(this.Nodes[i].Value);
                        writer.WriteEndElement();

                        fixed (int* name = &amp;Nodes[i].value)
                        {

                            writer.WriteStartElement("Name");
                            writer.WriteValue(name-&gt;ToString());
                            writer.WriteEndElement();

                        }

                        if (Nodes[i].Parent1 != null)
                        {
                            fixed (int* parent1 = &amp;Nodes[i].Parent1.value)
                            {

                                writer.WriteStartElement("Parent1");
                                writer.WriteValue(parent1-&gt;ToString());
                                writer.WriteEndElement();
                            }
                        }
                        if (Nodes[i].Parent2 != null) {

                        fixed (int* parent2 = &amp;Nodes[i].Parent2.value)
                        {
                            writer.WriteStartElement("Parent2");
                            writer.WriteValue(parent2-&gt;ToString());
                            writer.WriteEndElement();
                        }
                    }
                        writer.WriteEndElement();
                    }
                //}
                handle.Free();
                writer.WriteEndElement();
                writer.WriteEndDocument();
                //XmlSerializer serializer = new XmlSerializer(typeof(List&lt;Node&gt;));
                //serializer.Serialize(writer, this.Nodes);

            }
</code></pre>

<p>Any idea why it's doing that?</p>

<p>Thanks</p>
