Unity 5.5.2f1 - 5.6.1f1 - error of interpolated lines?

I just updated the Unity version from 5.5.2f1 to 5.6.1f1. Suddenly I get an error message:

The interpolated strings function cannot be used because it is not part of the C # 4.0 language specification

The code below worked before the update.

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 have no clue if it should still work.

+5
source share
2 answers

It seems that the interpolated lines still do not work after the update. To use my above code, I did it the old way.

Instead:

 return $"{Timestamp}, {Humidity}, {Temp}, {Light}, {Button}"; 

I did:

 return string.Format ("{Timestamp}, {Humidity}, {Temp}, {Light}, {Button}", Timestamp, Humidity, Temp, Light, Button); 
-1
source

I have had success using

 string.format("{0},{1},{2},{3}, {4}", Timestamp, Humidity, Temp, Light, Button); 
-1
source

Source: https://habr.com/ru/post/1268088/


All Articles