Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can we assign Contiguous memory in .Net.
Posted

1 solution

AFAIK, we cannot control where we assign objects to memory in .Net.
 
Share this answer
 
Comments
CPallini 14-Jun-10 17:04pm    
I believe array items are in contiguous memory locations.
Abhinav S 15-Jun-10 0:40am    
ok. That's interesting.
This link does not clearly specify anything clearly though - http://msdn.microsoft.com/en-us/library/2z4khca9(VS.80).aspx
CPallini 15-Jun-10 3:17am    
try:
int[] val = new int[5000];
unsafe
{
fixed (int* p = val)
{
*(p + 4999) = 100;
}
Console.WriteLine("val[4999] ={0}", val[4999]);
}
Member 7217874 16-Jun-10 15:34pm    
Thanks Guys... for all of this.

But Somebody asked me
How to assign contiguous memory to some objects or variables in case of win forms.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900