Solved

Struct Array Error

Posted on 2004-10-14
1
218 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 500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

734 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