C#其他运算符

using System;

namespace OperatorsAppl {

   class Program {

      static void Main(string[] args) {
         /* example of sizeof operator */
         Console.WriteLine(The size of int is {0}, sizeof(int));
         Console.WriteLine(The size of short is {0}, sizeof(short));
         Console.WriteLine(The size of double is {0}, sizeof(double));

         /* example of ternary operator */
         int a, b;
         a = 10;
         b = (a == 1) ? 20 : 30;
         Console.WriteLine(Value of b is {0}, b);

         b = (a == 10) ? 20 : 30;
         Console.WriteLine(Value of b is {0}, b);
         Console.ReadLine();
      }
   }
}

相关文章

c#如何实现添加到列表代码:var list = new&...
c#循环访问字典代码:foreach(var item in m...
using System; namespace OperatorsAppl { class Program ...
using System; class Program { static void Main(string[...
using System; namespace OperatorsAppl { class Program {...
using System; namespace DeclaringConstants { class Pro...