Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Struct Array Error

Posted on 2004-10-14
1
Medium Priority
?
228 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
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

824 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