C# version and string interpolation
Created at 22 Aug 2021, 09:18
CT
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?
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