Can string interpolation syntax be used in server method?

Is it somehow possible to use C# string interpolation in server method?

For example:

...

var text = "the text";
var result = $"This is {text}";

...

The Innovator's default syntax checker gives an error for this code: Error Number: CS1056, Unexpected character '$'.

Can we make any change or add reference to make that syntax work?

I'm using Innovator server 11.SP12, if that helps.

Thanks,

Khanh

Parents
  • For C#, it depends on the C# version/.NET Framework that is being used for your Aras Installation/service pack. C#6 was introduced in .NET Framework 4.6, I believe. For example, in Innovator 12 (which requires .NET Framework 4.7.2, if I recall correctly), String interpolation works as you described in your code example. In older versions of Aras using older Frameworks, you will need to use string.Format() or StringBuilder as Angela suggested.

Reply
  • For C#, it depends on the C# version/.NET Framework that is being used for your Aras Installation/service pack. C#6 was introduced in .NET Framework 4.6, I believe. For example, in Innovator 12 (which requires .NET Framework 4.7.2, if I recall correctly), String interpolation works as you described in your code example. In older versions of Aras using older Frameworks, you will need to use string.Format() or StringBuilder as Angela suggested.

Children
No Data