20180309 - C# demo - 1

 1 using System;
 2 namespace HelloWorldApplication
 3 {
 4     class HelloWorld
 5     {
 6         static void Main(string[] args)
 7         {
 8             // 1
 9             Console.WriteLine("Hello C# World!");
10             Console.WriteLine("A:{0}, B:{1}", 10, 20);
11             Console.WriteLine("A:{1}, B:{0}", 10, 20);
12             Console.WriteLine("A:{0}, B:", 10, 20);
13             Console.WriteLine("A:{1}, B:", 10, 20);
14             Console.WriteLine("A:, B:", 10, 20);
15             // 2
16             String str1 = "C:\\User";
17             String str2 = @"C:\User";
18             String str = @"
19             Hello C# World!
20     C# ------        very strong language.
21             ";
22             Console.WriteLine(str1);
23             Console.WriteLine(str2);
24             Console.WriteLine("{1}{0}{1}", str,"/");
25             //3
26             int val = 123;
27             Object box = val;
28             int valx = (int)box;
29             Console.WriteLine(box);
30             Console.WriteLine(val);
31             Console.WriteLine(valx);
32             //4
33             int a = 9;
34             Object obj;
35             obj = a;
36             obj = 10;
37             Console.WriteLine("a: {0}", a);
38             Console.WriteLine("obj: {0}", obj);
39             //string
40             string xStr = "Hello C#";
41             Console.WriteLine(xStr);
42             Console.ReadKey();
43         }
44     }
45 }

 

转载于:https://www.cnblogs.com/coder211/p/8535240.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值