Closed ig-sinicyn closed 4 years ago
Nuget Version 3.1.1
Wow, that's fast. Thanks a lot 👍
Oops, System.FormattableString is in wrong namespace. Project
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Theraot.Core" Version="3.1.1" />
</ItemGroup>
</Project>
code
using System;
using System.Runtime.CompilerServices;
namespace TestTargeting
{
class Program
{
static void Main(string[] args)
{
TestMe($"{123.34}"); // error CS1503: Argument 1: cannot convert from 'string' to 'System.Runtime.CompilerServices.FormattableString'
}
public static void TestMe(FormattableString s)
{
Console.WriteLine(s.ToString());
}
}
}
3.1.2
Can confirm it works:)
Missing in net 4.5 and earlier. Use case (taken from Meziantou's blog post):