Click here to Skip to main content
15,904,503 members
Home / Discussions / C#
   

C#

 
GeneralRe: New Editor Pin
GunaChinna6-Feb-07 1:37
GunaChinna6-Feb-07 1:37 
GeneralRe: New Editor Pin
GunaChinna6-Feb-07 1:37
GunaChinna6-Feb-07 1:37 
Questioncopying files Pin
Lol215-Feb-07 20:45
Lol215-Feb-07 20:45 
AnswerRe: copying files Pin
Christian Graus5-Feb-07 21:56
protectorChristian Graus5-Feb-07 21:56 
QuestionNo connection could be made because the target machine actively refused it Pin
M Riaz Bashir5-Feb-07 20:44
M Riaz Bashir5-Feb-07 20:44 
AnswerRe: No connection could be made because the target machine actively refused it Pin
aSarafian5-Feb-07 22:23
aSarafian5-Feb-07 22:23 
GeneralRe: No connection could be made because the target machine actively refused it Pin
M Riaz Bashir5-Feb-07 22:51
M Riaz Bashir5-Feb-07 22:51 
QuestionUsing unsafe sizeof in c# Pin
The Geek5-Feb-07 19:46
The Geek5-Feb-07 19:46 
Hi all,

Thanks in anticipation.

I was working on something that reads a serialized (in vc++) file in c#. So I was using the unsafe sizeof to read or get the size of certain objects. I am providing some code snippet to make the problem comprehensive.

struct Node

{

public struct NodeConsumerSnID

{

Int32 m_nNoOfConsumers;

Int32 m_BranchAboveUniqueID;

}



////////// it is returning 8 Byte



public struct NodeConsumerSnID1

{

Int32 m_nNoOfConsumers;

Int16 m_BranchAboveUniqueID;// int16 or short

}

////////// it is returning 8 Byte



public struct NodeConsumerSnID2

{

Int16 m_nNoOfConsumers;// int16 or short

Int16 m_BranchAboveUniqueID;// int16 or short



}

////////// But it is returning 4 Byte



public struct NodeConsumerSnID3

{

Int16 m_nNoOfConsumers;// int16 or short

Int32 m_BranchAboveUniqueID;

}

////////// it is again returning 8 Byte





Now when I look through the output, sizeof(NodeConsumerSnID) returns 8 byte as expected. Also sizeof(NodeConsumerSnID2) returns 4 byte as expected. But unexpectedly, size0f(NodeConsumerSnID1) and sizeof(NodeConsumerSnID3) returns 8 bytes, whereas the expected value was 6 byte.

Can you please provide me some understanding on the same?

Regards,
Kangkan

-----------------------
Kan...

AnswerRe: Using unsafe sizeof in c# Pin
Christian Graus5-Feb-07 19:48
protectorChristian Graus5-Feb-07 19:48 
GeneralRe: Using unsafe sizeof in c# Pin
The Geek5-Feb-07 20:25
The Geek5-Feb-07 20:25 
Question'System.ComponentModel.win32Exception' Pin
Ankit Aneja5-Feb-07 19:25
Ankit Aneja5-Feb-07 19:25 
AnswerRe: 'System.ComponentModel.win32Exception' Pin
Judah Gabriel Himango6-Feb-07 8:05
sponsorJudah Gabriel Himango6-Feb-07 8:05 
QuestionHow can I SMTP and POP3 Pin
sjs4u5-Feb-07 18:55
sjs4u5-Feb-07 18:55 
AnswerRe: How can I SMTP and POP3 Pin
Christian Graus5-Feb-07 19:47
protectorChristian Graus5-Feb-07 19:47 
QuestionHelp on Remember password Pin
Nekshan5-Feb-07 18:40
Nekshan5-Feb-07 18:40 
AnswerRe: Help on Remember password Pin
Christian Graus5-Feb-07 19:50
protectorChristian Graus5-Feb-07 19:50 
QuestionThanx Graus ... Pin
Nekshan5-Feb-07 21:36
Nekshan5-Feb-07 21:36 
AnswerRe: Thanx Graus ... Pin
althamda5-Feb-07 23:12
althamda5-Feb-07 23:12 
AnswerRe: Thanx Graus ... Pin
VirtualVoid.NET6-Feb-07 3:28
VirtualVoid.NET6-Feb-07 3:28 
QuestionUse of OpenPOP.dll in C# asp.net web application Pin
EEmaan5-Feb-07 18:07
EEmaan5-Feb-07 18:07 
QuestionVisual studio 2005 C#.Net Pin
Sri harini5-Feb-07 18:01
Sri harini5-Feb-07 18:01 
AnswerRe: Visual studio 2005 C#.Net Pin
bobsugar2225-Feb-07 21:35
bobsugar2225-Feb-07 21:35 
QuestionWindows CE database Pin
Dinesh_v5-Feb-07 17:29
Dinesh_v5-Feb-07 17:29 
Questionip address conflict Pin
swethakk5-Feb-07 17:23
swethakk5-Feb-07 17:23 
Questionip address conflict Pin
swethakk5-Feb-07 17:22
swethakk5-Feb-07 17:22 

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.