[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

Struct Array Error

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
Kobi55
Asked:
Kobi55
1 Solution
 
AlexFMCommented:
Such initrialization is impossible because structure must be allocated on stack. To get the functionality you want convert structure to class.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now