代码如下:

 public partial class FramMain : Form
    {
        public FramMain()
        {
            InitializeComponent();
        }

        private void btnCheckedEqual_Click(object sender, EventArgs e)
        {
            object p = ckbObjectString.Checked ? (object)"C#编程词典" : new System.IO.FileInfo(@"d:\");                //正确地为变量添加引用
            if (ckbTypeofString.Checked)                                                                               //判断选择了哪一个类型
            {
                if (p is System.String)                                                                                //判断对象是否为字符串类型
                    MessageBox.Show("对象与指定类型兼容","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);      //提示兼容消息
                else
                    MessageBox.Show("对象与指定类型不兼容", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  //提示不兼容消息
            }
            else
            {
                if (p is System.IO.FileInfo)                                                                            //判断对象是否为文件类型
                    MessageBox.Show("对象与指定类型兼容","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);       //提示兼容消息
                else
                    MessageBox.Show("对象与指定类型不兼容", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  //提示不兼容消息
            }
        }
    }

C#Equal的使用的更多相关文章

  1. [LeetCode] Minimum Moves to Equal Array Elements II 最少移动次数使数组元素相等之二

    Given a non-empty integer array, find the minimum number of moves required to make all array element ...

  2. [LeetCode] Minimum Moves to Equal Array Elements 最少移动次数使数组元素相等

    Given a non-empty integer array of size n, find the minimum number of moves required to make all arr ...

  3. [LeetCode] Partition Equal Subset Sum 相同子集和分割

    Given a non-empty array containing only positive integers, find if the array can be partitioned into ...

  4. Equal Sides Of An Array

    参考:http://stackoverflow.com/questions/34584416/nested-loops-with-arrays You are going to be given an ...

  5. Int,Long比较重使用equal替换==

    首先,==有很多限制,如Integer 类型的值在[-128,127] 期间,Integer 用 “==”是可以的(参考),超过范围则不行,那么使用equal则代替则完全ok public stati ...

  6. 无法解决 equal to 操作中 "SQL_Latin1_General_CP1_CI_AS" 和 "Chinese_PRC_CI_AS"

    无法解决 equal to 操作中 "SQL_Latin1_General_CP1_CI_AS" 和 "Chinese_PRC_CI_AS" 之间 2011-0 ...

  7. LeetCode Minimum Moves to Equal Array Elements II

    原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/ 题目: Given a non-empt ...

  8. LeetCode Minimum Moves to Equal Array Elements

    原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements/ 题目: Given a non-empty i ...

  9. conflict between "Chinese_PRC_CI_AI" and "Chinese_PRC_CI_AS" in the equal to operation

    在SQL SERVICE做关联查询的时候遇到了"conflict between "Chinese_PRC_CI_AI" and "Chinese_PRC_CI ...

  10. why happen "WaitHandles must be less than or equal to 64"

    一.背景: 在一个项目中碰到大数据插入的问题,一次性插入20万条数据(SQL Server),并用200个线程去执行,计算需要花费多少时间,因此需要等200个线程处理完成后,记录花费的时间,需要考虑的 ...

随机推荐

  1. 配置 VS 2015 开发跨平台手机应用

    为了使用 VS 2015 开发跨平台手机应用,VS 2015 装了很多次,遇到了很多坑,才终于弄明白怎样配置才能正常使用C#开发手机应用,现把步骤分享给大家,以免大家少走弯路. 运行环境: Windo ...

  2. (转)c#缓存介绍

    在 ASP.NET 提供的许多特性中,缓存支持无疑是最值得欣赏的特性.相比 ASP.NET 的所有其他特性,缓存对应用程序的性能具有最大的潜在影响,利用缓存和其他机制,ASP.NET 开发人员可以接受 ...

  3. HTML、CSS、JS、PHP 的学习顺序~(零基础初学者)

    如果你有耐心坚持一年以上的话, 我会推荐HTML->CSS->JS->PHP的顺序来学习. 1. HTML学习:首先学习HTML,HTML作为标记语言是非常容易学的,把w3schoo ...

  4. alter database open resetlogs

    使用resetlogs选项,会把当前的日志序号(log sequence number)重设为1,并抛弃所有日志信息.在以下条件时需要使用resetlogs选项: 在不完全恢复(介质恢复): 使用备份 ...

  5. php+js 瀑布流源码

    官方网站:更多源码 新浪微博:QQ公众号 QQ:各种源码 602902342 大牛技术群: 452207697 下载地址:http://pan.baidu.com/s/1bnNipI3 密码: h93 ...

  6. 武汉科技大学ACM :1001: A + B Problem

    Problem Description Calculate A + B. Input Each line will contain two integers A and B. Process to e ...

  7. Intellij idea配置springMvc4.2.6

    Spring MVC属于SpringFrameWork的后续产品,已经融合在Spring Web Flow里面. 环境: Intellij iead 2016.1 java version " ...

  8. CSS XHTML规范化命名参考

    CSS命名规则 头:header 内容:content/containe 尾:footer 导航:nav 侧栏:sidebar 栏目:column 页面外围控制整体布局宽度:wrapper 左右中:l ...

  9. memcached学习笔记——连接模型

    文章链接:http://www.hcoding.com/?p=121 个人站点:JC&hcoding.com memcached是什么呢?memcached是一个优秀的.高性能的内存缓存工具. ...

  10. HTML&CSS基础学习笔记1.21-语义化标签

    语义化标签 “语义化”指的是机器在需要更少的人类干预的情况下能够研究和收集信息,让网页能够被机器理解,最终让人类受益. HTML 标签语义化是让大家直观的认识标签和属性的用途和作用,很明显<hx ...