博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c# equals和==的区别
阅读量:6937 次
发布时间:2019-06-27

本文共 251 字,大约阅读时间需要 1 分钟。

简言之:

equals必须是类型和值都得相等

== 只要值相等

 

注意:

void Main(){    int a=10;    short b=10;    Console.WriteLine(a.Equals(b)); //True  (short会隐式转换为int)    Console.WriteLine(b.Equals(a)); //False (int不会隐式转换为short)}

 

转载于:https://www.cnblogs.com/objectboy/p/4642686.html

你可能感兴趣的文章
red5 与tomcat集成配置 简单入门实例
查看>>
Vmware虚拟硬盘合并多个分割文件
查看>>
LeetCode-448. Find All Numbers Disappeared in an Array C#
查看>>
HDU 2364 (记忆化BFS搜索)
查看>>
紫书 例题 10-24 UVa 1641(面积计算)
查看>>
紫书 习题 10-21 UVa 1649 (组合数)
查看>>
js 函数常见的三种实例化方式
查看>>
js 点透
查看>>
猫 老鼠 人的编程题
查看>>
CodeForces 803E Roma and Poker
查看>>
CodeForces 609A USB Flash Drives
查看>>
当 better-scroll 遇见 Vue
查看>>
display:inline-block
查看>>
2018 MUltiU 9 dp / 8 upper_bound ; 构造?/
查看>>
[LUOGU] P2704 炮兵阵地
查看>>
mysql 5.7 详细图文安装教程
查看>>
idea出现插件突然失灵解决方案
查看>>
初识Redis(一)
查看>>
LeetCode 637. Average of Levels in Binary Tree
查看>>
docker swarm集群挂载宿主机目录
查看>>