Hi I have writen an Nested Structure in C# . Find the code snippet below:
public struct SMB_MESSAGE
{
#region SMB Parameter
public struct SMB_PARAMETERS
{
public byte WordCount;
public ushort[] Words;
}
#endregion
#region SMB Data
public struct SMB_DATA
{
public ushort ByteCount;
public struct Bytes
{
public ushort BufferFormat;
public byte[] Name;
}
}
#endregion
}
Now While I assign the Value to the the Inner structure as below:
SMB_MESSAGE SMBMESSAGE;
SMB_MESSAGE.SMB_PARAMETERS SMBPARAMETER;
SMBPARAMETER.WordCount=12;
SMBPARAMETER.Words=null;
SMB_MESSAGE.SMB_DATA SMBDATA;
SMBDATA.ByteCount=byteCount;
SMB_MESSAGE.SMB_DATA.Bytes bytes;
bytes.BufferFormat=bFormat;
bytes.Name=name;
Now When I look into the value of SMBMESSAGE while debugging it shows NameSpace.Form1.SMB_MESSAGE
and no values inside it. I can't also see a way to asign the values to SMBMESSAGE
.
If we can not assign values , then Why do we need to use nested structures?