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. 【UE4 C++】 启动 / 关闭外部exe、开启虚拟键盘

    启动/关闭外部exe 引擎自带 FPlatformProcess::CreateProc() FPlatformProcess::TerminateProc() windows api ShellEx ...

  2. Linux常用命令介绍(满足日常操作)

    大家好,今天来给大家分享一些Linux的常用命令,希望对大家有用 命令行的基本格式:   命令字 [选项] [参数]     其中,命令字.选项.参数之间用空格分开,多余的空格将被忽略.[ ]括起来的 ...

  3. 免费UML工具介绍 - 基于云技术

    现在,我们的时间很短,无法完成我们的项目.我们不想花时间在软件配置.安装上,而是集中精力解决问题,对吗? 今天我想给大家介绍一个非常特殊的IT专业人员工具.软件开发.战略分析.客户行程映射等灵活的免费 ...

  4. AIApe问答机器人Scrum Meeting 4.25

    Scrum Meeting 2 日期:2021年4月25日 会议主要内容概述:前后端针对WebAPI进行协调与统一工作,商量接下来两日计划:敲定部分设计细节. 一.进度情况 组员 负责 两日内已完成的 ...

  5. BUAA_2019_OO_第一单元总结

    一.基于度量来分析自己的程序结构 1.第一次作业 1.1类图: 第一次作业由于比较简单,我采用了面向过程的编程方式.在Polynomail类的构造函数中将项直接求导输出.这样的弊端显而易见,不能进行优 ...

  6. NOIP模拟84(多校17)

    T1 宝藏 解题思路 考场上一眼出 \(nlog^2\) 做法,然后没看见是 1s 3e5 的数据,我竟然以为自己切了?? 考完之后尝试着把二分改为指针的移动,然后就过了??或许是数据水吧,感觉自己的 ...

  7. FastAPI 学习之路(三十三)操作数据库

    通过创建pydantic模型进行验证提交数据 from pydantic import BaseModel class UserBase(BaseModel): email: str class Us ...

  8. VS2019、Qt5.12及QGis3.16开发常见问题汇总

    在C++.Qt软件开发过程中,常常遇到一些编译错误或警告:本文将VS2019.Qt5.12.10和QGis3.16.10的二次开发过程常见的问题做了整理,供大家参考,也便于日后查阅.该内容分为四部分: ...

  9. MyBatis源码分析(六):Spring整合分析

    一.Mybatis-Spring源码结构 二.Myabtis交给Spring管理的组件 1. dataSource 数据源 配置一个数据源,只要是实现了javax.sql.DataSource接口就可 ...

  10. Docker 安装 MySQL8

    1. 环境准备 创建挂载数据目录和配置文件 mkdir -p /mnt/mysql/data /etc/mysql/conf touch /etc/mysql/conf/my.cnf 2. 拉取镜像 ...