zoukankan      html  css  js  c++  java
  • 黑马程序员----C#基础知识05

    1、new操作符

    new操作符用于创建一个新的类型实例。它有三种形式:

    (1)对象创建表达式,用于创建一个类类型或值类型的实例。

    (2)数组创建表达式,用于创建一个数组类型实例。

    (3)代表创建表达式,用于创建一个新的代表类型实例。

     例:

      class A{}; A a = new A;

      int[] int_arr = new int[10];

      delegate double DFunc(int x); DFunc f = new DFunc(5);

    2、is 操作符

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace Is操作符
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine(1 is int);
                Console.WriteLine(1 is float);
                Console.WriteLine(1.0 is float);
                Console.WriteLine(1.0 is double);
                Console.ReadLine();

            }
        }
    }

    is操作符被用于动态地检查运行时对象类型是否和给定的类型兼容。运算“e is T”的结果,其中,e是一个表达式,T是一个类型,返回值是一个布尔值。

  • 相关阅读:
    iframe
    服务器 开发机 linux docker
    git
    iframe because an ancestor violates the following Content Security Policy directive: "frameancestors 'self'
    @babel/pluginproposaloptionalchaining
    jest
    富文本编辑器
    thymeleaf+layui渲染错误
    springboot静态资源访问
    layui的树型组件的使用
  • 原文地址:https://www.cnblogs.com/binxinquan/p/3167262.html
Copyright © 2011-2022 走看看