Click here to Skip to main content
15,890,579 members
Home / Discussions / C#
   

C#

 
Questionhow to implement cache memory mechanism in C# Pin
kalaveer30-Oct-06 1:07
kalaveer30-Oct-06 1:07 
AnswerRe: how to implement cache memory mechanism in C# Pin
Pete O'Hanlon30-Oct-06 2:47
mvePete O'Hanlon30-Oct-06 2:47 
QuestionPackaging Setup Files in a single File [modified] Pin
wasife30-Oct-06 0:42
wasife30-Oct-06 0:42 
AnswerRe: Packaging Setup Files in a single File Pin
FlyOnIT30-Oct-06 1:34
FlyOnIT30-Oct-06 1:34 
QuestionFile permission in C#.net Pin
Kunal Sagwaria29-Oct-06 23:53
Kunal Sagwaria29-Oct-06 23:53 
QuestionEveryone can access my file Pin
Kunal Sagwaria29-Oct-06 23:51
Kunal Sagwaria29-Oct-06 23:51 
QuestionDesign time toolstrips Pin
Gomac29-Oct-06 23:45
Gomac29-Oct-06 23:45 
QuestionRegarding nested structs: Instance Field Initializers Pin
Mairaaj Khan29-Oct-06 23:14
professionalMairaaj Khan29-Oct-06 23:14 
Hi,
The whole code works fine.
Except, when i decalared the instance of type ns1 within mystruct, the error "cannot have instance field initializers in structs" is produced. What is the reason benind this? Why we can not create instance fields in structs? while we can do that in classes.
And also, i didn't understand the term "instance field initializers".

public struct mystruct
    {
        public void display()
        {
            System.Console.WriteLine("My main Sturct");
        }

        public struct ns1 //nested struct
        {
            public void show(int n)
            {
                System.Console.WriteLine("nested struct 1: Call# " + n);
            }
        }// the nested struct ns1 ends

        <code>//following line gives the error 	
        //public ns1[] stary = new ns1[2]; </code>
   
    } // mystruct ends


its used as follows:
mystruct ms = new mystruct();
            ms.display();   //ms.stary[0].show(); ms.stary[1].show();

            mystruct.ns1 a = new mystruct.ns1();
            a.show(1);

            //Create and use struct array
            mystruct.ns1[] b = new mystruct.ns1[2]; 
            b[0].show(2);
            b[1].show(3);




_____________________________
Success is not something to wait for, its something to work for.

AnswerRe: Regarding nested structs: Instance Field Initializers Pin
Pete O'Hanlon29-Oct-06 23:48
mvePete O'Hanlon29-Oct-06 23:48 
GeneralRe: Regarding nested structs: Instance Field Initializers Pin
Mairaaj Khan30-Oct-06 0:09
professionalMairaaj Khan30-Oct-06 0:09 
GeneralRe: Regarding nested structs: Instance Field Initializers Pin
kalaveer30-Oct-06 1:24
kalaveer30-Oct-06 1:24 
GeneralRe: Regarding nested structs: Instance Field Initializers Pin
Pete O'Hanlon30-Oct-06 1:39
mvePete O'Hanlon30-Oct-06 1:39 
QuestionFile Browse Window Pin
Rustamyan29-Oct-06 22:44
Rustamyan29-Oct-06 22:44 
AnswerRe: File Browse Window Pin
subrata.jana29-Oct-06 23:05
subrata.jana29-Oct-06 23:05 
GeneralRe: File Browse Window Pin
subrata.jana29-Oct-06 23:07
subrata.jana29-Oct-06 23:07 
AnswerRe: File Browse Window Pin
saqib8230-Oct-06 2:50
saqib8230-Oct-06 2:50 
QuestionSerial port logger testing solution Pin
nemopeti29-Oct-06 22:27
nemopeti29-Oct-06 22:27 
Questionweird error... Pin
Support12329-Oct-06 22:23
Support12329-Oct-06 22:23 
AnswerRe: weird error... Pin
Robert Rohde30-Oct-06 0:21
Robert Rohde30-Oct-06 0:21 
GeneralRe: weird error... Pin
Support12330-Oct-06 1:22
Support12330-Oct-06 1:22 
Questionhow can i get text where mouse point ? Pin
Mory0Tiki29-Oct-06 22:18
Mory0Tiki29-Oct-06 22:18 
AnswerRe: how can i get text where mouse point ? Pin
sam#29-Oct-06 23:01
sam#29-Oct-06 23:01 
GeneralRe: how can i get text where mouse point ? Pin
Mory0Tiki30-Oct-06 6:36
Mory0Tiki30-Oct-06 6:36 
QuestionGiving F10 a Job Pin
myNameIsRon29-Oct-06 21:51
myNameIsRon29-Oct-06 21:51 
AnswerRe: Giving F10 a Job Pin
Pete O'Hanlon29-Oct-06 22:28
mvePete O'Hanlon29-Oct-06 22:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.