问题
I would like to compile C# 7.0 solution in Visual Studio 2015, but I have syntax error:
Error
ErrorMessage : 'DateTime' is a type but is used like a variable.
This is related to 'out variables' changed in C# 7.0
Unfortunately I can not use VS2017 (community) and THIS TUTORIAL - not working (master branch is adapted to VS2017 now).
Do you have an idea how to solve this problem?
回答1:
You just need to declare a DateTime
variable outside the call and pass the parameter with the out
keyword like this:
DateTime yuorParam;
method( ..., ..., out yourParam);
来源:https://stackoverflow.com/questions/45323063/c-sharp-7-0-out-variables-in-visual-studio-2015