Re: unsafe?????????
- From: Brian Gideon <briangideon@xxxxxxxxx>
- Date: Sun, 17 Jun 2007 18:48:39 -0700
On Jun 17, 11:47 am, "wmhnq" <w...@xxxxxxx> wrote:
private void button1_Click(object sender, EventArgs e)
{
unsafe
{
string str = "abcde";
fixed (char* pStr = str)
{
A a = new A(pStr);
a.change();
MessageBox.Show(str.ToString());
}
}
}
}
public class A
{
unsafe char* pStr = (char*)0;
public unsafe A(char* sss)
{
pStr =sss;
}
public unsafe void change()
{
*pStr = "fghijkl";//error,why??????
}
}
I'm not understanding the need for unsafe code in your example.
.
- References:
- unsafe?????????
- From: wmhnq
- unsafe?????????
- Prev by Date: Re: Marking code deprecated
- Next by Date: How do i process logoff operation
- Previous by thread: Re: unsafe?????????
- Next by thread: Re: Obtaining exclusive access to file / file lock
- Index(es):