Is there a way to execute methods with out parameters in Immediate window? For example, while debugging I want to check if a string variable value can be successfully parsed into datetime. To do that I want execute datetime.Tryparse in immediate window. Is there a way to execute it?
Asked
Active
Viewed 1,503 times
3
-
1What happened when you tried executing the method? – Servy Oct 13 '16 at 17:42
-
@Servy Suppose if I want to check the string variable result, I have to execute datetime.tryparse(result,somevariable). To do this the variable "somevariable" has to be declared beforehand (which i dont want to do because I'm just debugging my code in immediate window). Otherwise I will get the error error CS0103: The name 'somevariable' does not exist in the current context. – shanmuga raja Oct 13 '16 at 17:53
-
@shanmugaraja Yes, the variable needs to be declared. You'll have to declare it. – Servy Oct 13 '16 at 18:02
-
@Servy Can that be understood that you cannot execute a method with out parameter in immediate window unless you have a variable for the out parameter already declared? – shanmuga raja Oct 13 '16 at 18:10
-
I do understand it. What don't you understand about the fact that if you need a variable declared, that you should declare it? – Servy Oct 13 '16 at 20:18
1 Answers
1

Rom
- 1,183
- 1
- 8
- 18
-
The two lines of code DateTime dateTime;bool result = DateTime.TryParse(input,out dateTime); – shanmuga raja Oct 13 '16 at 18:00
-
-
1Based on the code you shown, the two lines of code DateTime dateTime;bool result = DateTime.TryParse(input,out dateTime); is not part of my code.I want to debug the string variable "input" from my immediate window by executing the DateTime.TryParse method. – shanmuga raja Oct 13 '16 at 18:02