using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CShapeTest
{
class Start
{
static void Main(string[] args)
{
// is 运算符,判断是否是该类型,如果是,返回真, 如果不是,返回假
int i = 10;
bool result = i is int;
Console.WriteLine("{0}", result);
// new 运算符,创建一个引用对象
string[] ls = new string[3];
ls[0] = "asp.net";
ls[1] = "C#";
ls[2] = "Java";
Console.WriteLine("{0}", ls[0]);
Console.WriteLine("{0}", ls[1]);
Console.WriteLine("{0}", ls[2]);
// type 运算符,可以获取系统类型的对象
Type _type = typeof(string);
Console.WriteLine("{0}", _type);
Console.ReadLine();
}
}
}
C#_is运算符,new运算符,typeof运算符
最新推荐文章于 2023-11-29 09:58:56 发布