C# number boost

PHPz
Release: 2023-09-17 11:33:20
forward
1022 people have browsed it

C# 数字提升

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 -

Example

using System;

class Program {
   static void Main() {
      short val1 = 99;
      ushort val2 = 11;

      int res = val1 * val2;
      Console.WriteLine(res);
   }
}
Copy after login

The above is the detailed content of C# number boost. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template