hi,
i am a newbie in C#. I am having a variable named stone inside a private function named rock. a variable stone is defined in a structure called sand and is accessed only as sand.stone inside the function rock. Now, I must access this variable called stone in another function...how can it be done...please help me guys.
sidhu51
0
Newbie Poster
Recommended Answers
Jump to PostDeclare that sand variable as a field.
class Sample{ Sand sand; void method1() { } ..... }
Jump to Postclass Sample{ Sand sand=new Sand(); void method1() { sand.stone ...... } void method2() { sand.stone ...... } ..... }
Jump to PostAnchor a; private void ExtractAnchor(string[] line, List<Anchor> SLTPAnchors, int i) { a.Version = line[i + 2].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[1]; }
All 10 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
sidhu51
0
Newbie Poster
kvprajapati
1,826
Posting Genius
Team Colleague
sidhu51
0
Newbie Poster
sidhu51
0
Newbie Poster
kvprajapati
1,826
Posting Genius
Team Colleague
sidhu51
0
Newbie Poster
sidhu51
0
Newbie Poster
kvprajapati
1,826
Posting Genius
Team Colleague
sidhu51
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.