General information
Category:
Coding, syntax and commands
Environment versions
Network:
Windows 2003 Server
>Hi,
>Does C# support same name in sub method?
>For example, I have declare string abc in ClassA.MethodA(), I also have declared same variable in ClassA.MethodB(). ClassA.MethodA() will call ClassA.Method().
>
>I faced problem that, whenever I have this, program will behave weird, is either take wrong value, or just jump back to calling program without completely execute all necessary code.
>
>Any ideas?
>
>Please advice. Thank you
Sure, C# will allow you to do that.
A couple of questions. Is string abc being passed as a parameter to MethodB()? If so, is it passed by value or by reference? Also, when you say the same variable abc is declared in MethodB() you mean that one is also a string, right?
If you can post the code I'm sure we can figure it out.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only