C# 7.0 'out variables' in Visual Studio 2015 [duplicate]

家住魔仙堡 提交于 2019-12-20 05:39:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!