Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Struct Array Error

Posted on 2004-10-14
1
Medium Priority
?
225 Views
Last Modified: 2010-04-15
Hi

I got  Error when i trying to put Struct Array in another struct    

 Error: cannot have instance field initializers in structs          


                        private struct MyAcount
            {
                  int     InData ;                    
                  int      OutData ;                  
                  int     TotalData ;              
                  bool   EndOfDay  ;                
            }

            

            private struct InOut
            {
                  long  IdEmp ;                    
                  long  Badge  ;                  
                  MyAcount[] InOutAll  = new MyAcount[5] ;
                  string DayNum  ;              
                  long   DayAll ;                
            }

            
0
Comment
Question by:Kobi55
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

Accepted Solution

by:
AlexFM earned 1500 total points
ID: 12306417
Such initrialization is impossible because structure must be allocated on stack. To get the functionality you want convert structure to class.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question