Here is the definition of the "fixed" key word from the SDK:
The fixed statement prevents the garbage collector from relocating a movable
variable.
Note that the variable is movable, and the fixed pointer only affects the
garbage collector. So, you would move the pointer in the same way.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
"Schwammkopf" <mo********@yahoo.comwrote in message
news:64**********************************@microsof t.com...
Hi !
What i want to do in C++ is :
int a[] = new a[2];
a[0] = 0, a[1] = 0;
int* p = &a[0];
while (1) // any condition instead of 1
{
(*p)++;
if (p == &a[0])
p = &a[1];
else
p = &a[0];
}
How is this in C# possible ? I googled and found the unsafe / fixed
statements, but couldnt find
how to reassign the pointer to a new address.
C# :
unsafe {
fixed (int* p = &a[0]) {
while(1)
{
//how can i now reassign the p to another address ?
}
}
--
mfg
Anil Bakirci