代码如下:

 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. 用Ant实现Java项目的自动构建和部署(转)

    Ant是一个Apache基金会下的跨平台的构件工具,它可以实现项目的自动构建和部署等功能.在本文中,主要让读者熟悉怎样将Ant应用到Java项目中,让它简化构建和部署操作. 一.            ...

  2. C# 导出word文档及批量导出word文档(2)

    aspose.word主要是通过把读取出来的数据放到datatable里,在datable里做相应的格式的调整,再导出到word文档里.mvc和webform最后导出的语句略有不同,在mvc的cont ...

  3. php连接mysql的一些方法总结

    为了能让PHP连接MSSQL,系统需要安装MSSQL,PHP,且在PHP.ini中的配置中,将       ;extension=php_mssql.dll前面的;去掉 1.连接MSSQL       ...

  4. 阿里大鱼simplexmlelement object 取值PHP

    SimpleXMLElement Object(    [code] => 15    [msg] => Remote service error    [sub_code] => ...

  5. DESTOON系统文章模块默认设置第一张图片为标题图的方法

    连上FTP或者其他方法打开网站目录下的\module\article\admin\template\edit.tpl.php修改设置内容第 <input name="post[thum ...

  6. 关于Linux平台malloc的写时拷贝(延迟分配)【转】

    Linux内核定义了“零页面”(内容全为0的一个物理页,且物理地址固定),应用层的内存分配请求,如栈扩展.堆分配.静态分配等,分配线性地址后,就将页表项条目指向“零页面”(指定初始值的情况除外),这样 ...

  7. ssm+jsp+自定义标签实现分页,可以通用(后端实现)

    从controller到mapper.xml的后端实现 只梳理分页相关代码 1 controller里面相关 ModelAndView mv = new ModelAndView("/lis ...

  8. 另一种root方法,Android boot.img破解

    一.破解原理 Android手机获得Root权限,其实就是让/system和/data分区获得读写的权限.这两个分区的权限配置,一般在根分区的init.rc文件中,修改这个文件可永久获得root权限. ...

  9. php 过滤html标签的函数

    1:strip_tags(string,allow)用来过滤html标签,参数string必须,allow是指定允许哪些标签通过. 例如: <?php $info='<a href=&qu ...

  10. Altium Designer规则

    1.PCB规则 是PCB设计中至关重要的一个环节:保证PCB符合电气要求.机械加工(精度)要求:为自动布局.布线和部分手动布局.布线操作提供依据 为规则检查提供依据,PCB编辑期间,AD会实时地进行一 ...