Visual Studio 2015中的C#7.0``变量''

编程入门 行业动态 更新时间:2024-10-28 04:22:52
本文介绍了Visual Studio 2015中的C#7.0``变量''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在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``变量''

本文发布于:2023-11-04 10:39:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557692.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   Studio   Visual

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!