zoukankan      html  css  js  c++  java
  • Question:关于C#连续赋值的面试题

    我们知道C#中 a=b=c;是合法的,例如:
     
    int i,j,k;
    i=j=k=1;
     
    下面有两道题:
    1:
    const int x=1;
    short y;
    object z;
    z=y=x;
    //请问下面的输出是什么?
    Console.WriteLine(z.GetType().ToString());
    2:
     
    class C
     {
         private string x;
         public string X
         {
             get { return x ?? ""; }
             set { x = value; }
         }
     } 
    
    static void Main()
    {
        C c = new C();
        object z;
        z = c.X = null;
    
        //下面两句话输出什么
        System.Console.WriteLine(z == null);
        System.Console.WriteLine(c.X == null);
    }
  • 相关阅读:
    There is an overlap in the region chain修复
    There is an overlap in the region chain
    region xx not deployed on any region server
    python 中的re模块,正则表达式
    TCP粘包问题解析与解决
    yield from
    Git push提交时报错Permission denied(publickey)...Please make sure you have the correct access rights and the repository exists.
    mysql 中Varchar 与char的区别
    Mysql 字符集及排序规则
    请实现一个装饰器,限制该函数被调用的频率,如10秒一次
  • 原文地址:https://www.cnblogs.com/LoveJenny/p/2091619.html
Copyright © 2011-2022 走看看