Click here to Skip to main content
15,899,474 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to discard invalid (ASCII 0-32) user input in editbox? [modified] Pin
SandeepN10-Apr-07 12:39
SandeepN10-Apr-07 12:39 
QuestionXslCompiledTransform.Transform() to a string Pin
eggie510-Apr-07 8:56
eggie510-Apr-07 8:56 
AnswerRe: XslCompiledTransform.Transform() to a string Pin
eggie510-Apr-07 9:24
eggie510-Apr-07 9:24 
QuestionStoring references in a class Pin
Ephoy10-Apr-07 8:39
Ephoy10-Apr-07 8:39 
AnswerRe: Storing references in a class Pin
Martin#10-Apr-07 9:11
Martin#10-Apr-07 9:11 
GeneralRe: Storing references in a class Pin
Ephoy10-Apr-07 10:09
Ephoy10-Apr-07 10:09 
GeneralRe: Storing references in a class [modified] Pin
Martin#11-Apr-07 3:11
Martin#11-Apr-07 3:11 
AnswerRe: Storing references in a class Pin
Scott Dorman10-Apr-07 17:48
professionalScott Dorman10-Apr-07 17:48 
Lothver wrote:
The modules are implemented as a class and the parameter (input or output) might have different types from module to module. The references is stored as Object.


You really should look at implementing this using generics. Storing everything as an Object is expensive because you are getting hit with boxing/unboxing operations (converting from reference to value types and vice versa) all over the place.

The problem you are seeing is a result of the way your Compute function works. This function takes the value of i, adds it to the value in input and stores it in output. The only time input gets set is during construction.

If you step through this in a debugger you will see the following sequence of events:

module mod1 = new module(firstInput);
 
mod1.input == 1
mod2.output == 0
 
module mod2 = new module(mod1.output);
 
mod2.input == 0
mod2.output == 0
 
mod1.compute(2);
 
mod1.input == 1
mod1.ouptut == 3
 
mod2.compute(3);
 
mod2.input == 0
mod2.output == 3


You either need to change the order of your calls or change your compute function.

-----------------------------
In just two days, tomorrow will be yesterday.

GeneralRe: Storing references in a class Pin
Ephoy11-Apr-07 0:11
Ephoy11-Apr-07 0:11 
GeneralRe: Storing references in a class Pin
Scott Dorman12-Apr-07 2:53
professionalScott Dorman12-Apr-07 2:53 
Questionconvert grayscale array to Image Pin
aei_totten10-Apr-07 7:17
aei_totten10-Apr-07 7:17 
QuestionMDI application childform maximize Pin
sinosoidal10-Apr-07 6:33
sinosoidal10-Apr-07 6:33 
AnswerRe: MDI application childform maximize Pin
il_masacratore11-Apr-07 21:29
il_masacratore11-Apr-07 21:29 
QuestionString Manipulation Question Pin
JMOdom10-Apr-07 6:20
JMOdom10-Apr-07 6:20 
AnswerRe: String Manipulation Question Pin
Are Jay10-Apr-07 8:47
Are Jay10-Apr-07 8:47 
QuestionC# accessing Excel Pin
shamidi10-Apr-07 5:55
shamidi10-Apr-07 5:55 
AnswerRe: C# accessing Excel Pin
led mike10-Apr-07 7:39
led mike10-Apr-07 7:39 
QuestionFileWatcher Pin
LCI10-Apr-07 5:32
LCI10-Apr-07 5:32 
AnswerRe: FileWatcher Pin
vineas10-Apr-07 5:48
vineas10-Apr-07 5:48 
QuestionUser Control - comments for public properties in form designer Pin
peterchen10-Apr-07 5:13
peterchen10-Apr-07 5:13 
AnswerRe: User Control - comments for public properties in form designer Pin
Martin#10-Apr-07 5:40
Martin#10-Apr-07 5:40 
QuestionListview and remove or disallow duplicates Pin
Saamir10-Apr-07 5:07
Saamir10-Apr-07 5:07 
AnswerRe: Listview and remove or disallow duplicates Pin
Saamir10-Apr-07 6:51
Saamir10-Apr-07 6:51 
QuestionReference type or not Pin
hamidkhan10-Apr-07 4:38
hamidkhan10-Apr-07 4:38 
AnswerRe: Reference type or not Pin
Guffa10-Apr-07 7:08
Guffa10-Apr-07 7:08 

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.