📄 class1.cs
字号:
using System;
namespace Example_ref
{
/// <summary>
/// 学生类
/// </summary>
public class Student
{
public string strName; //姓名
public int nAge; //年龄
/// <summary>
/// 构造函数
/// </summary>
public Student(string _strName,int _nAge)
{
this.strName=_strName;
this.nAge=_nAge;
}
/// <summary>
/// 长大_nSpan岁
/// </summary>
public void Grow(int _nSpan,ref int _nOutCurrentAge)
{
this.nAge+=_nSpan;
_nOutCurrentAge=this.nAge;
}
}
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
Student s=new Student("张三",20);
int nCurrentAge=0;
s.Grow(3,ref nCurrentAge);
Console.WriteLine(s.nAge); //输出23
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -