C# 不同数据类型之间的转换, 隐式转换, 显示转换

C# 不同数据类型之间的转换, 隐式转换, 显示转换
using System;

namespace DemoConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            int intValue1, intValue2;
            long longValue1, longValue2;
            intValue1 = 123;
            longValue1 = 456;
            longValue2 = intValue1;     // 隐式转换
            intValue2 = (int)longValue1;// 显示转换
            Console.WriteLine("{0} = {1}", intValue1, longValue2);
            Console.WriteLine("(int){0} = {1}", longValue1, intValue2);

            Console.Read();
        }
    }
}

作者最新文章
C# 使用 CSVHelper 操作 csv 文件, .net core, .net framework 读取写入 csv 文件
C# 实现字符串文本换行的方法,文本如何换行
C# 如何循环读取文件每一行文本内容
C# DateTime AddMonths 的错误用法导致跳过日期
C# 全角转换半角,半角转换为全角