using System;
class Class1
{
public int vlaue = 0;
}
class Test
{
static void Main()
{
int v1 = 0;
int v2 = v1;
v2 = 123;
Class1 r1 = new Class1();
Class1 r2 = r1;
r2.vlaue = 123;
Console.WriteLine("Value:{0},{1}", v1, v2);
Console.WriteLine("Refs:{0},{1}", r1.vlaue, r2.vlaue);
}
}

using System;
public enum Color
{
Red,Blue,Green
}
public struct Point
{
public int x,y;
}
public interface IBase
{
void F();
}
public interface IDerived:IBase
{
void G();
}
public class A
{
protected void H()
{
Console.WriteLine("A.H");
}
}
public class B:A,IDerived
{
public void F()
{
Console.WriteLine("B.F,implementation of IDerived.F");
}
public void G()
{
Console.WriteLine("B.G,implementation of IDerived.G");
}
override protected void H()
{
Console.WriteLine("B.H,override of A.H");
}
}
//public delegate void EmptyDelegate();
using System;
class Test
{
static void Main()
{
string s = "Test";
string t = string.Copy(s);
Console.WriteLine(s == t);
Console.WriteLine((object)s == (object)t);
}
}
using System;
class Test
{
static void Main()
{
int intvalue = 123;
long longvalue = intvalue;
Console.WriteLine("(long){0}={1}", intvalue, longvalue);
}
}
using System;
class Test
{
static void Main()
{
long longValue = Int64.MaxValue;
int intValue = (int)longValue;
Console.WriteLine("(int){0}={1}", longValue, intValue);
}
}
using System;
class Test
{
static void Main()
{
int[] arr = new int[5];
for (int i = 0; i < arr.Length; i++)
arr[i] = i * i;
for (int i = 0; i < arr.Length; i++)
Console.WriteLine("arr[{0}]={1}", i, arr[i]);
}
}
using System;
class Test
{
static void Main()
{
int[] a1;
int[,] a2;
int[, ,] a3;
int[][] j2;
int[][][] j3;
}
}
using System;
class Test
{
static void Main()
{
int[] a1 = new int[] { 1, 2, 3 };
int[,] a2 = new int[,] { { 1, 2, 3 }, { 4, 5, 6 } };
int[, ,] a3 = new int[10, 20, 30];
int[][] j2 = new int[3][];
j2[0] = new int[] { 1, 2, 3 };
j2[1] = new int[] { 1, 2, 3, 4, 5, 6 };
j2[2] = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
}
}
using System;
class Test
{
static void Main()
{
Console.WriteLine(3.ToString());
}
}
using System;
class Test
{
static void Main()
{
int i = 123;
object o = i;
int j = (int)o;
Console.WriteLine(i);
Console.WriteLine(o);
}
}
using System;
class Test
{
static void F(int p)
{
Console.WriteLine("p={0}", p);
p++;
}
static void Main()
{
int a = 1;
Console.WriteLine("pre:a={0}",a);
F(a);
Console.WriteLine("post:a={0}",a);
}
}
using System;
class Test
{
static void Swap(ref int a,ref int b)
{
int t = a;
a = b;
b = t;
}
static void Main()
{
int x = 1;
int y = 2;
Console.WriteLine("pre:x={0},y={1}", x, y);
Swap(ref x, ref y);
Console.WriteLine("post:x={0},y={1}", x, y);
}
}

随机推荐

  1. Spring Boot中使用PostgreSQL数据库

    在如今的关系型数据库中,有两个开源产品是你必须知道的.其中一个是MySQL,相信关注我的小伙伴们一定都不陌生,因为之前的Spring Boot关于关系型数据库的所有例子都是对MySQL来介绍的.而今天 ...

  2. NOIP模拟73

    T1 小L的疑惑 解题思路 第一眼不是正解,又是 bitset 优化可以得到的 60pts 的部分分. 打着打着突然发现这个东西好像和之前做过的某个题有一些相似,试着打了一下. 然后样例过了,然后对拍 ...

  3. 极简SpringBoot指南-Chapter04-基于SpringBoot的书籍管理Web服务

    仓库地址 w4ngzhen/springboot-simple-guide: This is a project that guides SpringBoot users to get started ...

  4. ApacheCon 首次亚洲大会火热来袭,SphereEx 邀您共赴年度盛会!

    ApacheCon 是 Apache 软件基金会(ASF)的官方全球系列大会.作为久负盛名的开源盛宴,ApacheCon 在开源界备受关注,也是开源运动早期的知名活动之一. ApacheCon 每年举 ...

  5. 利用PATH环境变量 - 提升linux权限~👻

    利用PATH提升linux权限 参考地址:https://www.hackingarticles.in/linux-privilege-escalation-using-path-variable/ ...

  6. 二进制对比工具HexCmp的使用

    一.前提 遇到一个问题,文件通过后台上传成功后,客户端下载解压后,再次加载文件报错,报错信息该模块应包含一个程序集清单. (异常来自 HRESULT:0x80131018).但该错误文件与原文件大小一 ...

  7. Java初步学习——2021.10.05每日总结,第五周周二

    (1)今天做了什么: (2)明天准备做什么? (3)遇到的问题,如何解决? 今天学习了二维数组,包括二维数组的声明,和二维数组的创建.以及获取二维数组的长度,其中要注意的是二维数组是每个元素都是一维数 ...

  8. 数据库已经存在表, django使用inspectdb反向生成model实体类

    1.通过inspectdb处理类,可以将现有数据库里的一个或者多个.全部数据库表生成Django model实体类 python manage.py inspectdb --database defa ...

  9. mysql锁场景及排查

    1.查询长时间不返回: 在表 t 执行下面的 SQL 语句: mysql> select * from t where id=1; 查询结果长时间不返回. 一般碰到这种情况的话,大概率是表 t ...

  10. 初学Python-day8 案例2

    中奖率 1 import random 2 num = 123456 3 i = 1 4 while True: 5 win = random.randrange(100000, 999999) 6 ...