Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 13th, 2006, 09:28 AM
Registered User
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic array of struct

I've just migrated from VB.NET
Suppose that I have defined the struct as below
struct MyStruct
  int i;
  int j;
  int [] N;

Then when I declared my array of struct like
  MyStruct [] Strc;

It was ok but when I compiled it, I got the error that it should be assigned. I found out that I need to use the New(). However, I dont know how to declare and assign with New.

Thanks for your responce.

Old September 13th, 2006, 10:45 AM
Authorized User
Join Date: Feb 2006
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to MAKO

MyStruct[] Strc = new MyStruc[index];

MAKO - "El super simio"
Old September 14th, 2006, 06:12 AM
Registered User
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

That's right, But how should I Delcalre the array N of the struct.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic picturebox array thomaz C# 3 September 17th, 2008 01:15 PM
Help me - fill dataGridView from struct array ranjithemail C++ Programming 0 May 10th, 2008 11:53 PM
Dynamic declaration of an array tenkasian C# 2 September 5th, 2007 10:14 PM
Dynamic array - please help OC Beginning VB 6 5 March 21st, 2004 05:11 AM
Dynamic Control array carl.dufresne@sita.aero Visual C++ 6 September 3rd, 2003 08:48 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.