Number promotion, as the name suggests, is to promote a smaller type to a larger type, such as from short to int.
In the example below we see number promotion multiplication in arithmetic operators.
Short types will be automatically promoted to larger types -
using System; class Program { static void Main() { short val1 = 99; ushort val2 = 11; int res = val1 * val2; Console.WriteLine(res); } }
The above is the detailed content of C# number boost. For more information, please follow other related articles on the PHP Chinese website!