Forum Discussion

KPham's avatar
KPham
Ideator I
7 years ago
Solved

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 check...
  • angela's avatar
    7 years ago

    Do you want to use Javascript or C#?

    For JS e.g. this may work:

    var age = 103;
    alert(`I'm ${age} years old!`);

    For C# you can use StringBuilder or String.Format.

  • cogres's avatar
    7 years ago

    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.