Xamarin Studio does not recognize String Interpolation

时间:2016-04-04 17:01:57

标签: c# xamarin xamarin.ios xamarin-studio

Xamarin Studio version 5.10.3 build 51

For example if I wrote this code:

var text = $"Some string with {order}";
text = text.ToLower();

Xamarin studio seems not able to determine what the data type of "text" is. enter image description here

"order" also is an object and I can't access its properties. I changed the C# version of my project and it didn't fix anything.

enter image description here

If you know a solution to this problem please tell me.

2 个答案:

答案 0 :(得分:2)

As per Xamarin forums, string interpolation works in Xamarin 6.0, Check the link below: https://forums.xamarin.com/discussion/55995/xamarin-studio-not-recognize-string-interpolation

答案 1 :(得分:2)

You need to ensure you're running on Xamarin Studio 6.0+. You can currently find this on the Alpha channel of the updater. I believe other versions have partial support for C# 6.

https://developer.xamarin.com/releases/studio/xamarin.studio_6.0/xamarin.studio_6.0/#Roslyn_integration

https://developer.xamarin.com/recipes/cross-platform/ide/change_updates_channel/