Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
Questionhow to increate a number Pin
lockepeak7-Jun-07 4:23
lockepeak7-Jun-07 4:23 
AnswerRe: how to increate a number Pin
Rick van Woudenberg7-Jun-07 4:35
Rick van Woudenberg7-Jun-07 4:35 
GeneralRe: how to increate a number Pin
lockepeak7-Jun-07 16:37
lockepeak7-Jun-07 16:37 
GeneralRe: how to increate a number Pin
Rick van Woudenberg8-Jun-07 1:33
Rick van Woudenberg8-Jun-07 1:33 
AnswerRe: how to increate a number Pin
DanB19837-Jun-07 4:36
DanB19837-Jun-07 4:36 
QuestionSimple array use, no looping = StackOverflowException? Pin
Christian Bailey7-Jun-07 4:14
Christian Bailey7-Jun-07 4:14 
AnswerRe: Simple array use, no looping = StackOverflowException? Pin
Mali Perica7-Jun-07 4:33
Mali Perica7-Jun-07 4:33 
AnswerRe: Simple array use, no looping = StackOverflowException? Pin
NassosReyzidis7-Jun-07 4:34
NassosReyzidis7-Jun-07 4:34 
Hi Cristian,
The problem is here:
public int[] ExampleArray
{
set
{
ExampleArray = value;
}
}
In the Setter curly Brackets you reset the property (Same Name), so when you call concreteHasArray.ExampleArray = otherArray;
you conccurently setting the ExampleAray.
Solution:
<br />
namespace ArrayTests<br />
{<br />
    class HasArray<br />
     {<br />
        private int[] _ExampleArray ; //Properties Expose a private member!! <br />
        public int[] ExampleArray<br />
        {<br />
            set<br />
            {<br />
                _ExampleArray  = value;//Set in the private member!!<br />
            }<br />
            get{return _ExampleArray;}//You need this so you can call concreteHasArray.ExapleArray and return the Array.<br />
        }<br />
        public HasArray()<br />
        {<br />
            ExampleArray = new int[2] { 1, 2 };<br />
        }<br />
    }<br />
<br />
    class Program<br />
    {<br />
        static void Main(string[] args)<br />
        {<br />
            HasArray concreteHasArray = new HasArray();<br />
            int[] otherArray = new int[2] { 3, 4 };<br />
           concreteHasArray.ExampleArray = otherArray;<br />
        }<br />
    }<br />
}<br />


Hope this helps
Nassos

GanDad

AnswerRe: Simple array use, no looping = StackOverflowException? Pin
Ian Shlasko7-Jun-07 4:35
Ian Shlasko7-Jun-07 4:35 
GeneralRe: Simple array use, no looping = StackOverflowException? Pin
revi227-Jun-07 4:58
revi227-Jun-07 4:58 
AnswerRe: Simple array use, no looping = StackOverflowException? Pin
Christian Bailey7-Jun-07 10:30
Christian Bailey7-Jun-07 10:30 
QuestionThreadPool. Any way to know when all threads finished? Pin
Diego F.7-Jun-07 4:06
Diego F.7-Jun-07 4:06 
AnswerRe: ThreadPool. Any way to know when all threads finished? Pin
Dave Kreskowiak7-Jun-07 4:44
mveDave Kreskowiak7-Jun-07 4:44 
GeneralRe: ThreadPool. Any way to know when all threads finished? Pin
Diego F.7-Jun-07 4:52
Diego F.7-Jun-07 4:52 
AnswerRe: ThreadPool. Any way to know when all threads finished? Pin
Luc Pattyn7-Jun-07 4:50
sitebuilderLuc Pattyn7-Jun-07 4:50 
GeneralRe: ThreadPool. Any way to know when all threads finished? Pin
Diego F.7-Jun-07 4:56
Diego F.7-Jun-07 4:56 
GeneralRe: ThreadPool. Any way to know when all threads finished? Pin
Luc Pattyn7-Jun-07 5:13
sitebuilderLuc Pattyn7-Jun-07 5:13 
GeneralRe: ThreadPool. Any way to know when all threads finished? Pin
Dave Kreskowiak7-Jun-07 5:28
mveDave Kreskowiak7-Jun-07 5:28 
QuestionPassword Permission Pin
Saiyed Alam7-Jun-07 3:54
Saiyed Alam7-Jun-07 3:54 
AnswerRe: Password Permission Pin
Dave Kreskowiak7-Jun-07 4:38
mveDave Kreskowiak7-Jun-07 4:38 
GeneralRe: Password Permission Pin
Dan Neely7-Jun-07 7:31
Dan Neely7-Jun-07 7:31 
GeneralRe: Password Permission Pin
Dave Kreskowiak7-Jun-07 8:21
mveDave Kreskowiak7-Jun-07 8:21 
AnswerRe: Password Permission Pin
Rick van Woudenberg7-Jun-07 5:02
Rick van Woudenberg7-Jun-07 5:02 
AnswerRe: Password Permission Pin
Dan Neely7-Jun-07 7:29
Dan Neely7-Jun-07 7:29 
QuestionDouble seperator disappears upon insert in DB Pin
Rick van Woudenberg7-Jun-07 3:37
Rick van Woudenberg7-Jun-07 3:37 

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.