using System;
public class Program
{
public static void Main()
var temp1 = "6.";
int value = 0;
if (double.TryParse(temp1, out var doubleValue))
value = (int)doubleValue;
}
else
throw new FormatException($"Could not parse {temp1}");
Console.WriteLine(value);