C#Equal的使用
代码如下:
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的使用的更多相关文章
- [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 ...
- [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 ...
- [LeetCode] Partition Equal Subset Sum 相同子集和分割
Given a non-empty array containing only positive integers, find if the array can be partitioned into ...
- Equal Sides Of An Array
参考:http://stackoverflow.com/questions/34584416/nested-loops-with-arrays You are going to be given an ...
- Int,Long比较重使用equal替换==
首先,==有很多限制,如Integer 类型的值在[-128,127] 期间,Integer 用 “==”是可以的(参考),超过范围则不行,那么使用equal则代替则完全ok public stati ...
- 无法解决 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 ...
- LeetCode Minimum Moves to Equal Array Elements II
原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/ 题目: Given a non-empt ...
- LeetCode Minimum Moves to Equal Array Elements
原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements/ 题目: Given a non-empty i ...
- 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 ...
- why happen "WaitHandles must be less than or equal to 64"
一.背景: 在一个项目中碰到大数据插入的问题,一次性插入20万条数据(SQL Server),并用200个线程去执行,计算需要花费多少时间,因此需要等200个线程处理完成后,记录花费的时间,需要考虑的 ...
随机推荐
- C#_Socket网络编程实现的简单局域网内即时聊天,发送文件,抖动窗口。
最近接触了C#Socket网络编程,试着做了试试(*^__^*) 实现多个客户端和服务端互相发送消息 发送文件抖动窗口功能 服务端: using System; using System.Collec ...
- vb的LINQ实现
vb实现LINQ非常简单的例子: Dim numbers() As Integer = {1, 2, 3, 4, 5, 6, 7} Dim allNumbers = From number In nu ...
- django: db - many to one
models 模块中的对象有三种对应关系:多对一,多对多,一对一.本讲说明多对一关系. blog/models.py: from django.db import models class Emplo ...
- 前端笔试题目小结--获取输入参数用户名;查询URL字符串参数
编写一个JavaScript函数getSuffix,用于获得输入参数的后缀名.如输入abc.txt,返回txt. str1 = "abc.txt"; function getSuf ...
- shell获取日期(昨天,明天,上月,下月)
今天 sh-4.1$ echo `date +%Y-%m-%d` 2016-08-17 昨天 sh-4.1$ echo `date -d "last day" +%Y-%m-%d` ...
- POJ3104 Drying(二分查找)
POJ3104 Drying 这个题由于题目数据比较大(1 ≤ ai ≤ 109),采用贪心的话肯定会超时,自然就会想到用二分. 设C(x)为true时表示所用时间为X时,可以把所有的衣服都烘干或者自 ...
- linux下enum的使用
enum T { status1, status2, } Linux下: 1.做函数返回值时enum T f():不能写成T f(): 2.if(i == status1)不能写成 if(i == T ...
- php 之 文件上传(0523)
如何上传图片: 上传页面: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http ...
- jQuery读取JSON总结
1.jQuery 部分 <script src="js/jquery.js" type="text/javascript"></script& ...
- python入门安装
一.在python官网上下载python3.4或python2.7版本,这两个版本目前比较稳定,安装第3方包相对而言没有什么问题. 二.安装成功后,在计算机->属性->高级系统设置-> ...