C# version and string interpolation

Created at 22 Aug 2021, 09:18
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CT

ctid3999979

Joined 05.07.2021

C# version and string interpolation
22 Aug 2021, 09:18


Hi

When I try to use the $ string interpolation, such as the example below, I get an "Unexpected character: $" error message and the code fails to compile.

double percentProfit = Math.Round(netProfit / Account.Balance * 100, 2);
string percentProfitText = $"Open Position Profit: {percentProfit}%";

This feature was added in C#6 and according to my VS2019, this project, which I created in cTrader and edited in VS, is using 7.2.

I'd prefer not to use the String.Format() method for readability.

Any idea how to get the $ interpolation working?


@ctid3999979
Replies

PanagiotisCharalampous
23 Aug 2021, 11:28

Hi ctid3999979,

cTrader does not support C# 6.0 and this feature at the moment.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous