```c#
using System;
namespace Test_03_String
{
class Program
{
static void Main(string[] args)
{
String str;
str = "hello";
Console.WriteLine(str);
str = "zhangsan";
Console.WriteLine(str);
}
}
}
```
你这是要问什么,不想问什么的话
请采纳
或者详细描述一下问题
给 str 的两次赋值,怎么获取str的地址。分别显示出来
static unsafe void Main(string[] args)
{
String str;
str = "hello";
Console.WriteLine(str);
fixed (char* p = str)
{
Console.WriteLine("str地址= 0x{0:x}", (int)p);
}
str = "zhangsan";
Console.WriteLine(str);
fixed (char* p = str)
{
Console.WriteLine("str地址= 0x{0:x}", (int)p);
}
}
项目属性里须选上不安全代码那一项。