By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,866 Members | 1,704 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,866 IT Pros & Developers. It's quick & easy.

Marshaling a structure conatining a fixed length array of another structure in C#

P: 1
I need an example of how to marshal a structure that has
an array of another structures as a member. An example as mentioned below
Expand|Select|Wrap|Line Numbers
  1. [StructLayout(LayoutKind.Sequential)]
  2.         public struct strcutdata        {
  3.                         public System.UInt16 ln;
  4.                           public int in;
  5.                         public System.UInt32 tn;
  8.         }
  10.         [StructLayout(LayoutKind.Sequential,Size=320)]
  11.         public struct structContainer
  12.         {
  14.                       public strcutdata []arrCont;
  17.         }
When I create an object of "strcutdata" and pass it as reference to the unmanaged function it gives me a "Null reference exception". Please provide me a solution on this.

Thanks in advance..
Jun 27 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.