Click here to Skip to main content
15,917,533 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help with unsafe code ( array of pointer to a stucture) Pin
Alan Balkany17-Sep-08 3:23
Alan Balkany17-Sep-08 3:23 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Preetham.N17-Sep-08 3:30
Preetham.N17-Sep-08 3:30 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Guffa17-Sep-08 3:32
Guffa17-Sep-08 3:32 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Alan Balkany17-Sep-08 3:35
Alan Balkany17-Sep-08 3:35 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Preetham.N17-Sep-08 3:42
Preetham.N17-Sep-08 3:42 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Alan Balkany17-Sep-08 3:45
Alan Balkany17-Sep-08 3:45 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Preetham.N17-Sep-08 3:47
Preetham.N17-Sep-08 3:47 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Alan Balkany17-Sep-08 3:58
Alan Balkany17-Sep-08 3:58 
This works:

public struct RoomDef
{
public ushort Id;
public string Name;
public string Status;
public string Location;
};


private void Form1_Load(object sender, EventArgs e)
{
    RoomDef []nee = new RoomDef[5];
    RoomDef testPtr = new RoomDef();

    nee[1] = testPtr;
}


The 'struct' can be replaced with 'class' and it still works.

I suspect the array of structs is five 14-byte structures that follow each other in memory. But if a class is used, I suspect the array is five 4-byte pointers to RoomDef objects allocated in the heap.

It's hard to test this theory because using the sizeof() operator generates a compile error.
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Preetham.N17-Sep-08 4:06
Preetham.N17-Sep-08 4:06 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Alan Balkany17-Sep-08 4:38
Alan Balkany17-Sep-08 4:38 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Guffa17-Sep-08 8:52
Guffa17-Sep-08 8:52 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Alan Balkany18-Sep-08 3:52
Alan Balkany18-Sep-08 3:52 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Alan Balkany17-Sep-08 4:04
Alan Balkany17-Sep-08 4:04 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) [modified] Pin
Guffa17-Sep-08 8:46
Guffa17-Sep-08 8:46 
AnswerRe: Help with unsafe code ( array of pointer to a stucture) Pin
Guffa17-Sep-08 3:25
Guffa17-Sep-08 3:25 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Preetham.N17-Sep-08 3:33
Preetham.N17-Sep-08 3:33 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Guffa17-Sep-08 8:40
Guffa17-Sep-08 8:40 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Preetham.N17-Sep-08 3:50
Preetham.N17-Sep-08 3:50 
AnswerRe: Help with unsafe code ( array of pointer to a stucture) Pin
Preetham.N17-Sep-08 23:40
Preetham.N17-Sep-08 23:40 
QuestionHow to Set Expiration Policy to an Application Object in ASP.Net Applciation? Pin
BhanuRegonda17-Sep-08 1:56
BhanuRegonda17-Sep-08 1:56 
AnswerRe: How to Set Expiration Policy to an Application Object in ASP.Net Applciation? Pin
N a v a n e e t h17-Sep-08 2:08
N a v a n e e t h17-Sep-08 2:08 
QuestionThreshold type control - calculating size Pin
Gareth H17-Sep-08 1:51
Gareth H17-Sep-08 1:51 
AnswerRe: Threshold type control - calculating size Pin
BhanuRegonda17-Sep-08 2:01
BhanuRegonda17-Sep-08 2:01 
GeneralRe: Threshold type control - calculating size Pin
Gareth H17-Sep-08 2:06
Gareth H17-Sep-08 2:06 
AnswerRe: Threshold type control - calculating size Pin
Alan Balkany17-Sep-08 3:33
Alan Balkany17-Sep-08 3:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.