Helpful BPM Tip-o-the-day - String Interpolation

In BPMs, we are now allowed to use a new String Interpolation feature (C# version 6). This makes code more readable than the older String.Format command. Note that I have used all three ways shown below to assemble strings, but the new way is much clearer and easier on the eyes.
Also note that the Product Configurator does NOT support this yet. :frowning_face:

Old way:

string myName = "Tim";
int myAge = 29;
//old ways
string MyString0 = "Name: " + myName +", Age: " + myAge.ToString() + ".";
string MyString1 = string.Format("Name: {0}, Age: {1}.",myName,myAge);

//new way
string MyString2 = $"Name: {myName}, Age: {myAge}.";

The results of all three of the “MyString” variables should hold the same exact resulting content… also note that both of these will automatically format numbers, dates, strings, etc.

“Name: Tim, Age: 29.”

6 Likes

Hello Tim,

What is the version of Epicor that this is implemented in?

We are on 10.1.400.19. Multi-line strings work, but not interpolation.

10.2.200.16
@timshuwy, when will string interpolation be supported in Customizations? Just tried it in a new customization, throws an error. It would be REALLY nice to be CONSISTENT across any coding in the system!