I am testing the following code in C# and it can be run successfully. My question is I can assign one type of data to another type of data in the following example, but why it is still called type-safe language? Thanks.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
var intNum = 5;
var strNum = "5";
var result = intNum + strNum;
Console.WriteLine(result);
}
}
}
It can be compiled successfully and result is 55.