Unity 5.5.2f1至5.6.1f1-插值字符串错误? [英] Unity 5.5.2f1 to 5.6.1f1 - interpolated strings error?
本文介绍了Unity 5.5.2f1至5.6.1f1-插值字符串错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚将我的Unity版本从5.5.2f1更新为5.6.1f1.突然出现错误:
I've just updated my Unity version from 5.5.2f1 to 5.6.1f1. Suddenly I get the error:
功能'内插字符串'不能使用,因为它不是一部分 C#4.0语言规范
Feature `interpolated strings' cannot be used because it is not part of the C# 4.0 language specification
下面的代码在更新之前效果很好.
The code below worked well before updating.
public class SensorData
{
public int Timestamp { get; set; }
public float Humidity { get; set; }
public float Temp { get; set; }
public int Light { get; set; }
public int Button { get; set; }
public override string ToString()
{
return $"{Timestamp}, {Humidity}, {Temp}, {Light}, {Button}";
}
}
我不知道它是否仍然可以工作.
I don't have a clue if its supposed to still work.
推荐答案
似乎插值字符串在更新后仍然无法正常工作.为了仍然使用我上面提到的代码,我采用了旧方法.
It seems that interpolated strings are still not working after updating. To still use my above mentioned code, I did it the old way.
代替:
return $"{Timestamp}, {Humidity}, {Temp}, {Light}, {Button}";
我做到了:
return string.Format ("{Timestamp}, {Humidity}, {Temp}, {Light}, {Button}", Timestamp, Humidity, Temp, Light, Button);
这篇关于Unity 5.5.2f1至5.6.1f1-插值字符串错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文