我想在Visual Studio 2015中编译C#7.0解决方案,但出现语法错误:
I would like to compile C# 7.0 solution in Visual Studio 2015, but I have syntax error:
错误
ErrorMessage:'DateTime'是一种类型,但用作变量.
ErrorMessage : 'DateTime' is a type but is used like a variable.
这与在C#7.0中更改的输出变量"有关
This is related to 'out variables' changed in C# 7.0
很遗憾,我无法使用VS2017(社区)和此教程-不起作用(master分支现在适用于VS2017).
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?
推荐答案您只需要在调用外部声明一个DateTime变量,并使用out关键字传递参数,如下所示:
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);更多推荐
Visual Studio 2015中的C#7.0``变量''
发布评论