Eager Evaluation during String Interpolation - CSharp Language Basics

CSharp examples for Language Basics:string

Description

Eager Evaluation during String Interpolation

Demo Code

using System;/*ww  w  . ja  v a2s.  c o  m*/
using System.ComponentModel;
class EagerEvaluation
{
   static void Main()
   {
      string value = "Before";
      FormattableString formattable = $"Current value: {value}";
      Console.WriteLine(formattable);
      value = "After";
      Console.WriteLine(formattable);
   }
}

Result


Related Tutorials