Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
AnswerRe: Specified cast is not valid. i can't understand error Pin
OriginalGriff20-Dec-16 2:30
mveOriginalGriff20-Dec-16 2:30 
GeneralRe: Specified cast is not valid. i can't understand error Pin
Member 1289974620-Dec-16 2:34
Member 1289974620-Dec-16 2:34 
GeneralRe: Specified cast is not valid. i can't understand error Pin
Ralf Meier20-Dec-16 2:38
mveRalf Meier20-Dec-16 2:38 
AnswerRe: Specified cast is not valid. i can't understand error Pin
Ralf Meier20-Dec-16 2:36
mveRalf Meier20-Dec-16 2:36 
GeneralRe: Specified cast is not valid. i can't understand error Pin
Member 1289974620-Dec-16 2:44
Member 1289974620-Dec-16 2:44 
AnswerRe: Specified cast is not valid. i can't understand error Pin
Richard Deeming20-Dec-16 2:45
mveRichard Deeming20-Dec-16 2:45 
AnswerRe: Specified cast is not valid. i can't understand error Pin
Nelson Costa Inácio21-Dec-16 5:54
Nelson Costa Inácio21-Dec-16 5:54 
QuestionIs there anything wrong with passing state via argument? Pin
TheOnlyRealTodd20-Dec-16 0:12
professionalTheOnlyRealTodd20-Dec-16 0:12 
I first learned C# then C. As I've been working in C a lot lately, I've had to do without classes obviously since it's not really an OOP language.

I've gotten rather accustomed to passing stuff in as arguments and I'm writing a C# program right now where I've been passing "state" around via the method arguments rather than the typical storing fields/properties on the class and then accessing them from the class methods. Is there anything "wrong" about doing this? Is there anything "wrong" with not using the constructor to initialize member variables to certain values and instead just using a function in the class that calls the other business functions? E.G.

C#
someObject myObject = new someObject();

var processResult = myObject.process(someString,Processor_Option_1);


Instead of:

C#
someObject myObject = new someObject(someString,Processor_Option_1);

var processResult = myObject.result;


Note: Option 2 also uses class state member variables whereas 1 just passes it function-to-function as argument.
AnswerRe: Is there anything wrong with passing state via argument? Pin
Afzaal Ahmad Zeeshan20-Dec-16 0:39
professionalAfzaal Ahmad Zeeshan20-Dec-16 0:39 
GeneralRe: Is there anything wrong with passing state via argument? Pin
TheOnlyRealTodd20-Dec-16 17:56
professionalTheOnlyRealTodd20-Dec-16 17:56 
Questioni get an error (non-invocable member-- can't be used like a method) any help? Pin
Member 1289974619-Dec-16 23:21
Member 1289974619-Dec-16 23:21 
AnswerRe: i get an error (non-invocable member-- can't be used like a method) any help? Pin
Afzaal Ahmad Zeeshan19-Dec-16 23:32
professionalAfzaal Ahmad Zeeshan19-Dec-16 23:32 
GeneralRe: i get an error (non-invocable member-- can't be used like a method) any help? Pin
Member 1289974619-Dec-16 23:42
Member 1289974619-Dec-16 23:42 
GeneralRe: i get an error (non-invocable member-- can't be used like a method) any help? Pin
Afzaal Ahmad Zeeshan19-Dec-16 23:45
professionalAfzaal Ahmad Zeeshan19-Dec-16 23:45 
GeneralRe: i get an error (non-invocable member-- can't be used like a method) any help? Pin
OriginalGriff19-Dec-16 23:55
mveOriginalGriff19-Dec-16 23:55 
GeneralRe: i get an error (non-invocable member-- can't be used like a method) any help? Pin
Afzaal Ahmad Zeeshan20-Dec-16 0:00
professionalAfzaal Ahmad Zeeshan20-Dec-16 0:00 
GeneralRe: i get an error (non-invocable member-- can't be used like a method) any help? Pin
Member 1289974620-Dec-16 2:01
Member 1289974620-Dec-16 2:01 
QuestionUnable to copy file "obj\x86\Debug\**** Pin
Rebyc Rebyc19-Dec-16 5:40
Rebyc Rebyc19-Dec-16 5:40 
AnswerRe: Unable to copy file "obj\x86\Debug\**** Pin
Richard Deeming19-Dec-16 5:57
mveRichard Deeming19-Dec-16 5:57 
AnswerRe: Unable to copy file "obj\x86\Debug\**** Pin
Afzaal Ahmad Zeeshan19-Dec-16 23:39
professionalAfzaal Ahmad Zeeshan19-Dec-16 23:39 
QuestionC# Textbox number and symbols Pin
Pavlex418-Dec-16 6:12
Pavlex418-Dec-16 6:12 
AnswerRe: C# Textbox number and symbols Pin
Pavlex418-Dec-16 6:52
Pavlex418-Dec-16 6:52 
GeneralRe: C# Textbox number and symbols Pin
Pete O'Hanlon18-Dec-16 9:55
mvePete O'Hanlon18-Dec-16 9:55 
AnswerRe: C# Textbox number and symbols Pin
Michael_Davies18-Dec-16 7:31
Michael_Davies18-Dec-16 7:31 
QuestionConfused Over EventListener, EventRaiser, CallBack Pin
Liagapi18-Dec-16 1:57
Liagapi18-Dec-16 1:57 

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.