代码如下:

 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. Sybase常用函数

    ==================================常用函数===========================================字符串函数1)ISNULL(EXP1, ...

  2. ZOJ3558 How Many Sets III(公式题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud How Many Sets III Time Limit: 2 Seconds   ...

  3. h5connect.js 腾讯云视频点播使用指南

    http://video.qcloud.com/download/docs/QVOD_Player_Web_SDK_Developer_Guide.pdf 腾讯云视频点播服务 Web播放器SDK开发指 ...

  4. jquery1.9学习笔记 之选择器(基本元素五)

    多种元素选择器  jQuery("selector1,selector2,selectorN") 例子: <!doctype html> <html lang=' ...

  5. 如何在项目中使用gtest1.6

    问题 gtest1.6版本的README里说该版本不支持make install,其意思就是说你没法通过make命令把gtest安装到/usr/local/lib之类的目录,所以你也没办法通过下面的命 ...

  6. JSP(一)

    一.JSP概要 一]JSP的概念 1>JSP是SUN公司开发的一个基于服务端的一种动态WEB开发技术.         2>JSP的代码结构/内容 = HTML内容+JSP特有元素内容   ...

  7. 如何修改Qt标准对话框的文字(例如,英文改成中文)

    此篇文章参考qtcn论坛整理而成,因为文字和图片是本人亲自组织,所以仍算原创. http://www.qtcn.org/bbs/read-htm-tid-30650.html http://blog. ...

  8. list append 总是复制前面的参数,而不复制最后一个参数

    append 总是复制前面的参数,而不复制最后一个参数 (define a1 '(1 2 3)) (define a2 '(a b c)) (define x (append a1 a2)) x ; ...

  9. SSH转发机制

    第一部分 概述 当你在咖啡馆享受免费 WiFi 的时候,有没有想到可能有人正在窃取你的密码及隐私信息?当你发现实验室的防火墙阻止了你的网络应用端口,是不是有苦难言?来看看 SSH 的端口转发功能能给我 ...

  10. java解析网页的内容

    有时候,我们需要在java程序中获取一个连接,然后解析连接后,获取连接返回的内容结果来解析.准确的说是解析一个链接. 以下代码时解析百度首页的链接,获取的html代码的效果: public stati ...