bool b;
unsafe
{
bool* p1 = &b;
Console.WriteLine("p1: {0}", p1->ToString());
}
Gives me
p1:false
But I want to print the address. How can I do it?
bool b;
unsafe
{
bool* p1 = &b;
Console.WriteLine("p1: {0}", p1->ToString());
}
Gives me
p1:false
But I want to print the address. How can I do it?
using System;
namespace Test81
{
class MainClass
{
public static void Main(string[] args)
{
bool b;
unsafe
{
bool* p1 = &b;
Console.WriteLine("p1: 0x{0:X}", new IntPtr(p1).ToInt64());
}
}
}
}