Skip to content

Instantly share code, notes, and snippets.

@doterik
Last active July 12, 2024 05:32
Show Gist options
  • Save doterik/b529113a92e37e306805d1c2359bc7ee to your computer and use it in GitHub Desktop.
Save doterik/b529113a92e37e306805d1c2359bc7ee to your computer and use it in GitHub Desktop.
using System;
class C
{
void M()
{
string s1 = "1" + "2" + "3";
string s2 = "1" + (string)("2" + "3"); // dimmed - redundant
float f1 = 1f + 2f + 3f;
float f2 = 1f + (float)(2f + 3f);
float f3 = 1f + (float)(GetValue() + 3f);
int i1 = 1 + 2 + 3;
int i2 = 1 + (int)(2 + 3); // dimmed - redundant
double d1 = 1d + 2d + 3d;
double d2 = 1d + (double)(2d + 3d);
Console.Write($"{s1} {s2} {f1} {f2} {f3} {i1} {i2} {d1} {d2}");
}
float GetValue() => 2f;
}
{
"version": 1,
"target": "IL",
"mode": "Release"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment