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. null与undefined到底有啥区别?

    话不多说,直接先上结论: null 和 undefined 基本相同,只有细微差别 null 是表示缺少的标识,指示变量未指向任何对象,转为数值为 0 undefined 表示 "缺少值&q ...

  2. 题解 CF736D Permutations

    link Description 现在,你有一个二分图,点数为 \(2n\). 已知这个二分图的完备匹配的个数是奇数. 现在你要知道,删除每条边后,完备匹配个数是奇数还是偶数. \(1\le n\le ...

  3. pycharm 服务器连接及一些问题解决

    主要介绍一下如何使用pycharm连接服务器并在服务器上炼丹,并对遇到的一个小问题进行说明. 目录 1,SSH连接 2,linux常用命令 3,配置anaconda 4,运行代码 5,一个常见错误 1 ...

  4. kivy浮点布局

    from kivy.app import App from kivy.uix.floatlayout import FloatLayout class FloatLayoutWidget(FloatL ...

  5. CSP/S 2020 退役记

    上一次的AFO记 上上次的AFO记 Day -INF 一条咸鱼的垂死挣扎. RP+=INF Day 0 出发辣. 早上来到机房,带上了准备的面包和泡面....然而后来嫌太占地方就没拿...草了. 而且 ...

  6. vs2017和Qt5的字符编码问题

    默认vs2017的源文件字符编码是gbk的格式,Qt5的内部字符编码为utf8的格式,Qt5又去掉了设置字符串的接口,这样在源文件中使用了字符串之后,就会出现乱码问题,对原有代码逐个修改字符串是不可能 ...

  7. ESD

    Reverse standoff voltage是保护二极管的反向工作电压, 在这个电压, 二极管是不工作的. Breakdown voltage 是二极管的击穿电压, 超过这个电压后, 二极管迅速反 ...

  8. C语言单片机项目实战超声波雷达测距

    本实验是基于MSP430利用HC-SR04超声波传感器进行测距,测距范围是3-65cm,讲得到的数据显示在LCD 1602液晶屏上. 模块工作原理如下 (1)采用 IO 触发测距,给至少 10us 的 ...

  9. Codeforces Round #735 (Div. 2)

    这次的cf依旧掉分..... A题和B题在不懈死磕下瞎搞出来了,不过还是被C题卡住了... C. Mikasa 简述题意就是给定n和m,让n^0,n^1,n^2...,n^m,求着m+1个数中没有出现 ...

  10. js 在浏览器中的event loop事件队列

    目录 前言 认识一个栈两个队列 执行过程 异步任务怎么分配 简单例子 难一点的例子 前言 以下内容是js在浏览器中的事件队列执行,与在nodejs中有所区别,请注意. 都说js是单线程的,不过它本身其 ...